2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2010-2022 Mnemosyne LLC.
|
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
|
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2017-11-14 20:21:28 +00:00
|
|
|
#pragma once
|
|
|
|
|
2010-06-19 14:25:11 +00:00
|
|
|
#ifndef __TRANSMISSION__
|
2017-04-19 12:04:45 +00:00
|
|
|
#error only libtransmission should #include this header.
|
2010-06-19 14:25:11 +00:00
|
|
|
#endif
|
|
|
|
|
2021-12-15 21:25:42 +00:00
|
|
|
#include <cstdint> // intX_t, uintX_t
|
2020-08-11 18:11:55 +00:00
|
|
|
|
2011-01-29 18:56:53 +00:00
|
|
|
struct evbuffer;
|
2021-10-06 14:26:07 +00:00
|
|
|
struct tr_cache;
|
2021-12-15 21:25:42 +00:00
|
|
|
struct tr_torrent;
|
2010-06-19 14:25:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_cache* tr_cacheNew(int64_t max_bytes);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void tr_cacheFree(tr_cache*);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int tr_cacheSetLimit(tr_cache* cache, int64_t max_bytes);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int64_t tr_cacheGetLimit(tr_cache const*);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
int tr_cacheWriteBlock(
|
|
|
|
tr_cache* cache,
|
|
|
|
tr_torrent* torrent,
|
|
|
|
tr_piece_index_t piece,
|
|
|
|
uint32_t offset,
|
|
|
|
uint32_t len,
|
2017-04-19 12:04:45 +00:00
|
|
|
struct evbuffer* writeme);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
int tr_cacheReadBlock(
|
|
|
|
tr_cache* cache,
|
|
|
|
tr_torrent* torrent,
|
|
|
|
tr_piece_index_t piece,
|
|
|
|
uint32_t offset,
|
|
|
|
uint32_t len,
|
2017-04-19 12:04:45 +00:00
|
|
|
uint8_t* setme);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int tr_cachePrefetchBlock(tr_cache* cache, tr_torrent* torrent, tr_piece_index_t piece, uint32_t offset, uint32_t len);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int tr_cacheFlushDone(tr_cache* cache);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int tr_cacheFlushTorrent(tr_cache* cache, tr_torrent* torrent);
|
2010-06-19 14:25:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int tr_cacheFlushFile(tr_cache* cache, tr_torrent* torrent, tr_file_index_t file);
|