cache/proto1/cache_req.c
author terom@cl-543.hel-01.fi.sixxs.net
Thu, 07 Aug 2008 20:28:06 +0300
changeset 30 33e464fd6773
permissions -rw-r--r--
my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)

#include "cache.h"
#include "common.h"

enum cache_req_mode {
    REQ_GET,
    REQ_PUT,
};

struct cache_req {
    struct cache_op *op;
    
    off_t offset;

};

int cache_req_start (struct cache_req *ctx, struct cache *cache_info, u_int8_t key[CACHE_KEY_SIZE]) {
    // clear state
    memset(ctx, 0, sizeof(*ctx));
    
    // get the op
    if (_cache_op_get(&ctx->op, cache_info, key))
        goto error;

    
}

int cache_req_read_fd (struct cache_req *ctx, int fd) {
    return cache_op_read_fd(ctx->op, fd, ctx->offset);
}

int cache_req_write_fd (struct cache_req *ctx, int fd) {
    return cache_op_write_fd(ctx->op, fd, ctx->offset);
}