transmission: update from 2.13 to 2.22
[tomato.git] / release / src / router / transmission / libtransmission / cache.h
blob99c597df27ea3f7f09a429e90214863c2ad57654
1 /*
2 * This file Copyright (C) Mnemosyne LLC
4 * This file is licensed by the GPL version 2. Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
10 * $Id: cache.h 11782 2011-01-29 18:56:53Z jordan $
13 #ifndef __TRANSMISSION__
14 #error only libtransmission should #include this header.
15 #endif
17 #ifndef TR_CACHE_H
18 #define TR_CACHE_H
20 struct evbuffer;
22 typedef struct tr_cache tr_cache;
24 /***
25 ****
26 ***/
28 tr_cache * tr_cacheNew( int64_t max_bytes );
30 void tr_cacheFree( tr_cache * );
32 /***
33 ****
34 ***/
36 int tr_cacheSetLimit( tr_cache * cache, int64_t max_bytes );
38 int64_t tr_cacheGetLimit( const tr_cache * );
40 int tr_cacheWriteBlock( tr_cache * cache,
41 tr_torrent * torrent,
42 tr_piece_index_t piece,
43 uint32_t offset,
44 uint32_t len,
45 struct evbuffer * writeme );
47 int tr_cacheReadBlock( tr_cache * cache,
48 tr_torrent * torrent,
49 tr_piece_index_t piece,
50 uint32_t offset,
51 uint32_t len,
52 uint8_t * setme );
54 int tr_cachePrefetchBlock( tr_cache * cache,
55 tr_torrent * torrent,
56 tr_piece_index_t piece,
57 uint32_t offset,
58 uint32_t len );
60 /***
61 ****
62 ***/
63 int tr_cacheFlushDone( tr_cache * cache );
65 int tr_cacheFlushTorrent( tr_cache * cache,
66 tr_torrent * torrent );
68 int tr_cacheFlushFile( tr_cache * cache,
69 tr_torrent * torrent,
70 tr_file_index_t file );
72 #endif