author | Tero Marttila <terom@fixme.fi> |
Sat, 09 Aug 2008 00:59:01 +0300 | |
changeset 33 | b750e8865127 |
parent 31 | 12d5361e7472 |
child 36 | b4023990811e |
permissions | -rw-r--r-- |
30
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
1 |
#ifndef CACHE_ENGINE_H |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
2 |
#define CACHE_ENGINE_H |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
3 |
|
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
4 |
struct cache_engine { |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
5 |
/* |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
6 |
* Allocate a `struct cache`-compatible struct and return it via cache_ptr. |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
7 |
*/ |
31 | 8 |
int (*fn_init) (struct cache_engine *, struct cache **); |
30
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
9 |
|
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
10 |
/* |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
11 |
* Allocate a `struct cache_op`-compatible struct and return it via cache_ptr. |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
12 |
* |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
13 |
* Begin the index lookup. |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
14 |
*/ |
31 | 15 |
int (*fn_op_start) (struct cache *, struct cache_op **, struct cache_key *); |
33 | 16 |
|
17 |
/* |
|
18 |
* Return some information about the available data. |
|
19 |
*/ |
|
20 |
int (*fn_op_available) (struct cache_op *op, size_t *size, size_t *offset); |
|
31 | 21 |
|
22 |
/* |
|
23 |
* Prepare to write and possibly read this cache entry. |
|
24 |
* |
|
25 |
* size_hint, if nonzero, provides a guess at the size of the cache entry that can be used to optimize stuff |
|
26 |
*/ |
|
27 |
int (*fn_op_begin_write) (struct cache_op *, size_t size_hint); |
|
33 | 28 |
|
29 |
/* |
|
30 |
* Read some data from the given fd into this cache entry. Size may contain a non-zero value to hint at how many |
|
31 |
* bytes should be read, or zero to just read a suitable amount. Should be updated to how many bytes were actually |
|
32 |
* written (may be zero if writes are currently paused). |
|
33 |
*/ |
|
34 |
int (*fn_op_push) (struct cache_op *op, int fd, size_t *size); |
|
31 | 35 |
|
33 | 36 |
/* |
37 |
* No more calls to fn_op_push will take place. The cache entry now contains the complete data. |
|
38 |
*/ |
|
39 |
int (*fn_op_done) (struct cache_op *op); |
|
40 |
||
41 |
/* |
|
42 |
* The op is not needed for any operations anymore. Free any resources and memory associated with this op, |
|
43 |
* including the op itself. |
|
44 |
*/ |
|
45 |
int (*fn_op_close) (struct cache_op *op); |
|
30
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
46 |
}; |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
47 |
|
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
48 |
#endif /* CACHE_ENGINE_H */ |
33e464fd6773
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
terom@cl-543.hel-01.fi.sixxs.net
parents:
diff
changeset
|
49 |