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.
22 typedef struct tr_cache tr_cache
;
28 tr_cache
* tr_cacheNew( int64_t max_bytes
);
30 void tr_cacheFree( tr_cache
* );
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
,
42 tr_piece_index_t piece
,
45 struct evbuffer
* writeme
);
47 int tr_cacheReadBlock( tr_cache
* cache
,
49 tr_piece_index_t piece
,
54 int tr_cachePrefetchBlock( tr_cache
* cache
,
56 tr_piece_index_t piece
,
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
,
70 tr_file_index_t file
);