cache/op.c
author Tero Marttila <terom@fixme.fi>
Sat, 30 Aug 2008 19:13:15 +0300
changeset 49 10c7dce1a043
parent 37 f0188b445c84
permissions -rw-r--r--
autogenerate the memcache_test help output, and pipeline memcache requests
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
     1
#include <stdlib.h>
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
     2
#include <sys/queue.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
#include <string.h>
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
     4
#include <assert.h>
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
     5
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
     6
#include "../cache.h"
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
     7
#include "cache.h"
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
     8
#include "op.h"
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
     9
#include "req.h"
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    10
#include "engine.h"
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
    11
#include "../common.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
    12
33
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    13
void _cache_op_free (struct cache_op *op) {
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    14
    // check we have no reqs listed
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    15
    assert(op->req_list.lh_first == NULL);
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    16
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    17
    // remove it from the engine op_list
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    18
    LIST_REMOVE(op, node);
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    19
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    20
    // tell the engine to close/free the op
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    21
    if (op->cache->engine->fn_op_close(op))
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    22
        WARNING("fn_op_close failed");
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    23
}
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    24
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    25
int _cache_op_init (struct cache_op *op, struct cache *cache, struct cache_key *key) {
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
    26
    op->cache = cache;
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
    27
    op->key = key;
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
    28
    op->state = OP_STATE_INVALID;
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
    29
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
    30
    LIST_INIT(&op->req_list);
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    32
    // add this to the cache's list of ops
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    33
    LIST_INSERT_HEAD(&cache->op_list, op, node);
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    34
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    35
    return 0;
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
    36
}
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
    37
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
    38
struct cache_op *cache_op_find (struct cache *cache, struct cache_key *key) {
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
    39
    struct cache_op *op;
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
    40
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    41
    for (op = cache->op_list.lh_first; op != NULL; op = op->node.le_next) {
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    42
        if (op->key->length == key->length && memcmp(op->key->buf, key->buf, key->length) == 0)
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
    43
            break;
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
    44
    }
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
    45
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
    return op;
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
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
int cache_op_register (struct cache_op *op, struct cache_req *req) {
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
    50
    LIST_INSERT_HEAD(&op->req_list, req, node);
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    51
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    52
    return 0;
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
    53
}
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
    54
33
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    55
int cache_op_deregister (struct cache_op *op, struct cache_req *req) {
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    56
    // XXX: check that the req is in our list of ops?
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    57
    
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    58
    LIST_REMOVE(req, node);
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    59
    
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    60
    if (op->req_list.lh_first == NULL) {
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    61
        // the op is now unused
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    62
        _cache_op_free(op);
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    63
    }
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    64
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    65
    return 0;
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    66
}
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    67
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
    68
static int _cache_op_notify (struct cache_op *op) {
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
    69
    struct cache_req *req;
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
    70
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    71
    for (req = op->req_list.lh_first; req != NULL; req = req->node.le_next) {
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
    72
        if (cache_req_notify(req))
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
    73
            goto error;
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
    74
    }
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
    75
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
    76
    return 0;
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
    77
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
    78
error:
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
    79
    return -1;
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
    80
}
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
    81
33
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    82
int cache_op_available (struct cache_op *op, size_t *size, size_t *offset) {
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    83
    return op->cache->engine->fn_op_available(op, size, offset);
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    84
}
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
    85
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    86
int cache_op_begin_read (struct cache_op *op) {
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    87
    assert(op->state == OP_STATE_HIT);
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    88
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    89
    op->state = OP_STATE_OPEN_READ;
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    90
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    91
    return op->cache->engine->fn_op_begin_read(op);
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    92
}
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    93
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    94
int cache_op_begin_write (struct cache_op *op, size_t size_hint) {
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    95
    assert(op->state == OP_STATE_MISS);
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    96
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    97
    op->state = OP_STATE_OPEN_WRITE;
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
    98
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
    99
    return op->cache->engine->fn_op_begin_write(op, size_hint);
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   100
}
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   101
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   102
int cache_op_push (struct cache_op *op, int fd, size_t *size) {
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   103
    assert(op->state == OP_STATE_WRITE);
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   104
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   105
    return op->cache->engine->fn_op_push(op, fd, size);
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   106
}
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   107
37
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   108
int cache_op_pull (struct cache_op *op, int fd, size_t *offset, size_t *size) {
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   109
    assert(op->state == OP_STATE_READ || op->state == OP_STATE_WRITE);
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   110
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   111
    return op->cache->engine->fn_op_pull(op, fd, offset, size);
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   112
}
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   113
33
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
   114
int cache_op_done (struct cache_op *op) {
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   115
    assert(op->state == OP_STATE_WRITE);
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   116
33
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
   117
    return op->cache->engine->fn_op_done(op);
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
   118
}
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
   119
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   120
int _cache_op_lookup_done (struct cache_op *op, int found) {
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
   121
    // modify state
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
   122
    op->state = found ? OP_STATE_HIT : OP_STATE_MISS;
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
   123
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
   124
    // notify waiting reqs
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
   125
    return _cache_op_notify(op);
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
   126
}
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
   127
37
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   128
int _cache_op_read_ready (struct cache_op *op) {
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   129
    // modify state
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   130
    op->state = OP_STATE_READ;
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   131
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   132
    // notify waiting reqs
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   133
    return _cache_op_notify(op);
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   134
}
f0188b445c84 read/pull support
Tero Marttila <terom@fixme.fi>
parents: 36
diff changeset
   135
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   136
int _cache_op_write_ready (struct cache_op *op) {
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   137
    // modify state
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   138
    op->state = OP_STATE_WRITE;
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   139
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   140
    // notify waiting reqs
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   141
    return _cache_op_notify(op);
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   142
}
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   143
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   144
int _cache_op_data_available (struct cache_op *op) {
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   145
    // notify waiting reqs
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   146
    return _cache_op_notify(op);
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   147
}
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   148
36
b4023990811e rename/clean up states slightly and add lots of documentation
Tero Marttila <terom@fixme.fi>
parents: 33
diff changeset
   149
int _cache_op_write_done (struct cache_op *op) {
33
b750e8865127 working write cycle support
Tero Marttila <terom@fixme.fi>
parents: 31
diff changeset
   150
    op->state = OP_STATE_READ;
31
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   151
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   152
    // notify waiting reqs
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   153
    return _cache_op_notify(op);
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   154
}
12d5361e7472 req/write/push implemented
Tero Marttila <terom@fixme.fi>
parents: 30
diff changeset
   155