2010-06-19 14:25:11 +00:00
|
|
|
/*
|
2011-01-19 13:48:47 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2010-06-19 14:25:11 +00:00
|
|
|
*
|
2010-12-27 19:18:17 +00:00
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
2012-12-05 17:29:46 +00:00
|
|
|
* Transmission project are granted a special exemption to clause 2 (b)
|
2010-06-19 14:25:11 +00:00
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TRANSMISSION__
|
|
|
|
#error only libtransmission should #include this header.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TR_CACHE_H
|
|
|
|
#define TR_CACHE_H
|
|
|
|
|
2011-01-29 18:56:53 +00:00
|
|
|
struct evbuffer;
|
|
|
|
|
2010-06-19 14:25:11 +00:00
|
|
|
typedef struct tr_cache tr_cache;
|
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
tr_cache * tr_cacheNew (int64_t max_bytes);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
void tr_cacheFree (tr_cache *);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int tr_cacheSetLimit (tr_cache * cache, int64_t max_bytes);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int64_t tr_cacheGetLimit (const tr_cache *);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int tr_cacheWriteBlock (tr_cache * cache,
|
2010-06-19 14:25:11 +00:00
|
|
|
tr_torrent * torrent,
|
|
|
|
tr_piece_index_t piece,
|
|
|
|
uint32_t offset,
|
|
|
|
uint32_t len,
|
2012-12-05 17:29:46 +00:00
|
|
|
struct evbuffer * writeme);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int tr_cacheReadBlock (tr_cache * cache,
|
2010-06-19 14:25:11 +00:00
|
|
|
tr_torrent * torrent,
|
|
|
|
tr_piece_index_t piece,
|
|
|
|
uint32_t offset,
|
|
|
|
uint32_t len,
|
2012-12-05 17:29:46 +00:00
|
|
|
uint8_t * setme);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int tr_cachePrefetchBlock (tr_cache * cache,
|
2010-06-19 14:25:11 +00:00
|
|
|
tr_torrent * torrent,
|
|
|
|
tr_piece_index_t piece,
|
|
|
|
uint32_t offset,
|
2012-12-05 17:29:46 +00:00
|
|
|
uint32_t len);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int tr_cacheFlushDone (tr_cache * cache);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2012-12-05 17:29:46 +00:00
|
|
|
int tr_cacheFlushTorrent (tr_cache * cache,
|
|
|
|
tr_torrent * torrent);
|
|
|
|
|
|
|
|
int tr_cacheFlushFile (tr_cache * cache,
|
2010-06-19 14:25:11 +00:00
|
|
|
tr_torrent * torrent,
|
2012-12-05 17:29:46 +00:00
|
|
|
tr_file_index_t file);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
|
|
|
#endif
|