1publicinterfaceBackendStore{ 2// Store name 3Stringstore(); 4 5// Stored version 6StringstoredVersion(); 7 8// Database name 9Stringdatabase();1011// Get the parent provider12BackendStoreProviderprovider();1314// Get the system schema store15SystemSchemaStoresystemSchemaStore();1617// Whether it is the storage of schema18booleanisSchemaStore();1920// Open/close database21voidopen(HugeConfigconfig);22voidclose();23booleanopened();2425// Initialize/clear database26voidinit();27voidclear(booleanclearSpace);28booleaninitialized();2930// Delete all data of database (keep table structure)31voidtruncate();3233// Add/delete data34voidmutate(BackendMutationmutation);3536// Query data37Iterator<BackendEntry>query(Queryquery);38Iterator<Iterator<BackendEntry>>query(Iterator<Query>queries,39Function<Query,Query>queryWriter,40HugeGraphhugeGraph);41NumberqueryNumber(Queryquery);4243// Transaction44voidbeginTx();45voidcommitTx();46voidrollbackTx();4748// Get metadata by key49<R>Rmetadata(HugeTypetype,Stringmeta,Object[]args);5051// Backend features52BackendFeaturesfeatures();5354// Increase next id for specific type55voidincreaseCounter(HugeTypetype,longincrement);5657// Get current counter for a specific type58longgetCounter(HugeTypetype);59}
1publicclassRocksDBOptionsextendsOptionHolder{ 2 3privateRocksDBOptions(){ 4super(); 5} 6 7privatestaticvolatileRocksDBOptionsinstance; 8 9publicstaticsynchronizedRocksDBOptionsinstance(){10if(instance==null){11instance=newRocksDBOptions();12instance.registerOptions();13}14returninstance;15}1617publicstaticfinalConfigOption<String>DATA_PATH=18newConfigOption<>(19"rocksdb.data_path",20"The path for storing data of RocksDB.",21disallowEmpty(),22"rocksdb-data/data"23);2425publicstaticfinalConfigOption<String>WAL_PATH=26newConfigOption<>(27"rocksdb.wal_path",28"The path for storing WAL of RocksDB.",29disallowEmpty(),30"rocksdb-data/wal"31);3233publicstaticfinalConfigListOption<String>DATA_DISKS=34newConfigListOption<>(35"rocksdb.data_disks",36false,37"The optimized disks for storing data of RocksDB. "+38"The format of each element: `STORE/TABLE: /path/disk`."+39"Allowed keys are [g/vertex, g/edge_out, g/edge_in, "+40"g/vertex_label_index, g/edge_label_index, "+41"g/range_int_index, g/range_float_index, "+42"g/range_long_index, g/range_double_index, "+43"g/secondary_index, g/search_index, g/shard_index, "+44"g/unique_index, g/olap]",45null,46String.class,47ImmutableList.of()48);49}