contrib/logsqlite/logsqlite-fuse.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <limits.h>
#include <time.h>
#include <errno.h>
#include <fuse.h>
#include <sqlite3.h>

Data Structures

struct  myBuffer_t
struct  myDB_t

Defines

#define FUSE_USE_VERSION   26
#define QUERY_COUNT   7
#define READ_ROW_COUNT   "20"
#define BUF_SIZE_FACTOR   4096
#define BUF_MAX_UNUSED   5 * 60
#define DT_BUF_FACTOR   16
#define DT_MAX_TRIES   4
#define DEBUG(x...)   fprintf(stderr, x)
#define FUSE_DEBUG   ",debug"

Enumerations

enum  statement_n {
  GET_NEWEST, GET_NEWEST_SESSION, GET_NEWEST_UID, GET_SESSIONS,
  GET_UIDS, GET_DATA, REMOVE_UID
}

Functions

void myGC (myDB_t *db)
int mySplitPath (const char *path, const char **sid, const char **uid)
int myGetAttr (const char *path, struct stat *out)
int myReadDir (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi)
myBuffer_tmyBufferFind (myDB_t *db, const char *sid, const char *uid, off_t offset)
const char * myBodyEscape (const char *in)
const char * myTimestampFormat (const time_t timestamp)
void myBufferStep (sqlite3_stmt *stmt, myBuffer_t *buf)
int myReadFile (const char *path, char *out, size_t count, off_t offset, struct fuse_file_info *fi)
int myUnlink (const char *path)
int myReleaseFile (const char *path, struct fuse_file_info *fi)
int main (int argc, char *argv[])

Variables

static const char * queries [QUERY_COUNT+1]
static struct fuse_operations ops

Define Documentation

#define BUF_MAX_UNUSED   5 * 60

#define BUF_SIZE_FACTOR   4096

#define DEBUG ( x...   )     fprintf(stderr, x)

#define DT_BUF_FACTOR   16

#define DT_MAX_TRIES   4

#define FUSE_DEBUG   ",debug"

#define FUSE_USE_VERSION   26

#define QUERY_COUNT   7

#define READ_ROW_COUNT   "20"


Enumeration Type Documentation

enum statement_n

Enumerator:
GET_NEWEST 
GET_NEWEST_SESSION 
GET_NEWEST_UID 
GET_SESSIONS 
GET_UIDS 
GET_DATA 
REMOVE_UID 


Function Documentation

int main ( int  argc,
char *  argv[] 
)

const char* myBodyEscape ( const char *  in  ) 

myBuffer_t* myBufferFind ( myDB_t db,
const char *  sid,
const char *  uid,
off_t  offset 
)

void myBufferStep ( sqlite3_stmt *  stmt,
myBuffer_t buf 
)

void myGC ( myDB_t db  ) 

int myGetAttr ( const char *  path,
struct stat *  out 
)

int myReadDir ( const char *  path,
void *  buf,
fuse_fill_dir_t  filler,
off_t  offset,
struct fuse_file_info *  fi 
)

int myReadFile ( const char *  path,
char *  out,
size_t  count,
off_t  offset,
struct fuse_file_info *  fi 
)

int myReleaseFile ( const char *  path,
struct fuse_file_info *  fi 
)

int mySplitPath ( const char *  path,
const char **  sid,
const char **  uid 
)

const char* myTimestampFormat ( const time_t  timestamp  ) 

int myUnlink ( const char *  path  ) 


Variable Documentation

struct fuse_operations ops [static]

Initial value:

 {
        .getattr        = &myGetAttr,
        .readdir        = &myReadDir,
        .read           = &myReadFile,
        .unlink         = &myUnlink,
        .release        = &myReleaseFile
}

const char* queries[QUERY_COUNT+1] [static]

Initial value:

 {
        "SELECT ts FROM log_msg ORDER BY ts DESC LIMIT 1;",
        "SELECT ts FROM log_msg WHERE session = ?1 ORDER BY ts DESC LIMIT 1;",
        "SELECT ts FROM log_msg WHERE session = ?1 AND uid = ?2 ORDER BY ts DESC LIMIT 1;",
        "SELECT DISTINCT session FROM log_msg ORDER BY session ASC LIMIT -1 OFFSET ?1;",
        "SELECT DISTINCT uid FROM log_msg WHERE session = ?2 ORDER BY uid ASC LIMIT -1 OFFSET ?1;",
        "SELECT type, sent, uid, nick, ts, sentts, body FROM log_msg WHERE session = ?1 AND uid = ?2 ORDER BY ts ASC LIMIT " READ_ROW_COUNT " OFFSET ?3;",
        "DELETE FROM log_msg WHERE session = ?1 AND uid = ?2;",
        NULL
}


Generated on Sat Nov 22 22:30:43 2008 for ekg2 by  doxygen 1.5.1