cache/req.h
author Tero Marttila <terom@fixme.fi>
Wed, 27 Aug 2008 21:30:32 +0300
changeset 41 540737bf6bac
parent 37 f0188b445c84
permissions -rw-r--r--
sending requests, and partial support for receiving -- incomplete, not tested
#ifndef CACHE_REQ_H
#define CACHE_REQ_H

#include <sys/queue.h>

#include "../cache.h"
#include "op.h"

struct cache_req {
    // a pointer to the relevant key
    struct cache_key *key;

    // a copy
    // XXX: this should be moved to cache_op
    struct cache_key key_copy;
    
    // we are part of cache_op.req_list
    LIST_ENTRY(cache_req) node;
    
    // the user callback
    cache_callback cb_func;
    void *cb_data;
    
    // the op we are using
    struct cache_op *op;
    
    // were we the origional req that created the op, i.e. the one that handles open_write in case of OP_STATE_MISS?
    int is_write;
    
    // our own read offset into the cache entry.
    size_t read_offset;
};

/*
 * Called by cache_op to notify for changes in state
 */
int cache_req_notify (struct cache_req *req);

#endif /* CACHE_REQ_H */