static PyObject * pongo_open(PyObject *self, PyObject *args) { char *filename; pgctx_t *ctx; uint32_t initsize = 0; if (!PyArg_ParseTuple(args, "s|i:open", &filename, &initsize)) return NULL; ctx = dbfile_open(filename, initsize); dblock(ctx); pidcache_new(ctx); dbunlock(ctx); // Create a python proxy of the root data object return PongoCollection_Proxy(ctx, ctx->data); }
int main(int argc, char **argv) { int ret; struct hash_tree tree; init_filerec(); init_hash_tree(&tree); if (parse_options(argc, argv)) { usage(argv[0]); return EINVAL; } if (init_csum_module(DEFAULT_HASH_STR)) return ENOMEM; ret = dbfile_open(serialize_fname); if (ret) return ret; ret = dbfile_get_config(&disk_blocksize, &disk_hashes, &disk_files, &major, &minor); if (ret) return ret; blocksize = disk_blocksize; ret = prepare_statements(); if (ret) return ret; print_file_info(); if (num_to_print || print_all_hashes) print_by_size(); if (print_file_list) print_filerecs(); finalize_statements(); dbfile_close(); return ret; }