baseline

yet another open-source distributed versioning control system
Log | Files | Refs

objdb.h (2212B)


      1 /*
      2  * Copyright (c) 2014 Mohamed Aslan <maslan@sce.carleton.ca>
      3  *
      4  * Permission to use, copy, modify, and distribute this software for any
      5  * purpose with or without fee is hereby granted, provided that the above
      6  * copyright notice and this permission notice appear in all copies.
      7  *
      8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
      9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     15  */
     16 
     17 #ifndef _OBJDB_H_
     18 #define _OBJDB_H_
     19 
     20 #include <sys/types.h>
     21 #include "objects.h"
     22 
     23 struct objdb_ctx {
     24 	char *db_name;
     25 	char *db_path;
     26 	char *db_version;
     27 };
     28 
     29 struct objdb_ops {
     30 	char *name;
     31 	char *version;
     32 	/**/
     33 	int (*open)(struct objdb_ctx **, const char *, const char *);
     34 	int (*close)(struct objdb_ctx *);
     35 	int (*init)(struct objdb_ctx *);
     36 	/* file ops */
     37 	//int (*insert_from_file)(struct objdb_ctx *, enum objdb_type, const char *, char **);
     38 	int (*insert_file)(struct objdb_ctx *, struct file *);
     39 	int (*insert_dir)(struct objdb_ctx *, struct dir *);
     40 	int (*insert_commit)(struct objdb_ctx *, struct commit *);
     41 	int (*select_file)(struct objdb_ctx *, const char *, struct file *);
     42 	int (*select_dir)(struct objdb_ctx *, const char *, struct dir *);
     43 	int (*select_commit)(struct objdb_ctx *, const char *, struct commit *);
     44 	/* branch ops */
     45 	int (*branch_create)(struct objdb_ctx *, const char *);
     46 	int (*branch_create_from)(struct objdb_ctx *, const char *, const char *);
     47 	int (*branch_if_exists)(struct objdb_ctx *, const char *, int *);
     48 	int (*branch_set_head)(struct objdb_ctx *, const char *, const char *);
     49 	int (*branch_get_head)(struct objdb_ctx *, const char *, char **);
     50 	int (*branch_ls)(struct objdb_ctx *);
     51 	/**/
     52 	int (*remove)(struct objdb_ctx *, const char *, const char *);
     53 	int (*fsck)(struct objdb_ctx *);
     54 	int (*compress)(struct objdb_ctx *);
     55 	int (*dedup)(struct objdb_ctx *);
     56 };
     57 
     58 #endif