source: trunk/libtransmission/cache.h @ 11782

Last change on this file since 11782 was 11782, checked in by jordan, 11 years ago

(trunk libT) memory cache should use evbuffers to avoid unnecessary calls to memcpy -- done.

  • Property svn:keywords set to Date Rev Author Id
File size: 1.9 KB
Line 
1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
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.
9 *
10 * $Id: cache.h 11782 2011-01-29 18:56:53Z jordan $
11 */
12
13#ifndef __TRANSMISSION__
14 #error only libtransmission should #include this header.
15#endif
16
17#ifndef TR_CACHE_H
18#define TR_CACHE_H
19
20struct evbuffer;
21
22typedef struct tr_cache tr_cache;
23
24/***
25****
26***/
27
28tr_cache * tr_cacheNew( int64_t max_bytes );
29
30void tr_cacheFree( tr_cache * );
31
32/***
33****
34***/
35
36int tr_cacheSetLimit( tr_cache * cache, int64_t max_bytes );
37
38int64_t tr_cacheGetLimit( const tr_cache * );
39
40int 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 );
46
47int 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 );
53
54int tr_cachePrefetchBlock( tr_cache         * cache,
55                           tr_torrent       * torrent,
56                           tr_piece_index_t   piece,
57                           uint32_t           offset,
58                           uint32_t           len );
59
60/***
61****
62***/
63int tr_cacheFlushDone( tr_cache * cache );
64
65int tr_cacheFlushTorrent( tr_cache    * cache,
66                          tr_torrent  * torrent );
67
68int tr_cacheFlushFile( tr_cache         * cache,
69                       tr_torrent       * torrent,
70                       tr_file_index_t    file );
71
72#endif
Note: See TracBrowser for help on using the repository browser.