static ObjectDB CreateInMemoryDb() { var lowDb = new InMemoryKeyValueDB(); var db = new ObjectDB(); db.Open(lowDb, true); return db; }
public ObjectDBTransaction(ObjectDB owner, IKeyValueDBTransaction keyValueTr, bool readOnly) { _owner = owner; _keyValueTr = keyValueTr; _readOnly = readOnly; _transactionNumber = keyValueTr.GetTransactionNumber(); }
public RelationInfoResolver(ObjectDB objectDB) { FieldHandlerFactory = objectDB.FieldHandlerFactory; TypeConvertorGenerator = objectDB.TypeConvertorGenerator; Container = objectDB.ActualOptions.Container; FieldHandlerLogger = objectDB.FieldHandlerLogger; }
static ObjectDB CreateDb(IFileCollection fc) { var lowDb = new KeyValueDB(fc); var db = new ObjectDB(); db.Open(lowDb, true); return db; }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Need to have just one parameter with directory of ObjectDB"); return; } using (var dfc = new OnDiskFileCollection(args[0])) using (var kdb = new KeyValueDB(dfc)) using (var odb = new ObjectDB()) { odb.Open(kdb, false); using (var tr = odb.StartTransaction()) { var visitor = new ToStringVisitor(); var iterator = new ODBIterator(tr, visitor); iterator.Iterate(); var text = visitor.ToString(); Console.WriteLine(text); } } }
internal TableInfoResolver(IKeyValueDB keyValueDB, ObjectDB objectDB) { _keyValueDB = keyValueDB; _objectDB = objectDB; }
void LoadRelationNamesDict() { _relationId2Name = ObjectDB.LoadRelationNamesEnum(_tr.KeyValueDBTransaction) .ToDictionary(pair => pair.Key, pair => pair.Value); }
void LoadTableNamesDict() { _tableId2Name = ObjectDB.LoadTablesEnum(_tr.KeyValueDBTransaction) .ToDictionary(pair => pair.Key, pair => pair.Value); }
public RelationInfoResolver(ObjectDB objectDB) { _fieldHandlerFactory = objectDB.FieldHandlerFactory; _typeConvertorGenerator = objectDB.TypeConvertorGenerator; }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Need to have just one parameter with directory of ObjectDB"); return; } var action = "dump"; if (args.Length > 1) { action = args[1].ToLowerInvariant(); } switch (action) { case "dump": { using (var dfc = new OnDiskFileCollection(args[0])) using (var kdb = new KeyValueDB(dfc)) using (var odb = new ObjectDB()) { odb.Open(kdb, false); using (var tr = odb.StartTransaction()) { var visitor = new ToStringVisitor(); var iterator = new ODBIterator(tr, visitor); iterator.Iterate(); var text = visitor.ToString(); Console.WriteLine(text); } } break; } case "stat": { using (var dfc = new OnDiskFileCollection(args[0])) using (var kdb = new KeyValueDB(dfc)) { Console.WriteLine(kdb.CalcStats()); } break; } case "compact": { using (var dfc = new OnDiskFileCollection(args[0])) using (var kdb = new KeyValueDB(dfc, new SnappyCompressionStrategy(), 100 * 1024 * 1024, null)) { Console.WriteLine("Starting first compaction"); while (kdb.Compact(new CancellationToken())) { Console.WriteLine(kdb.CalcStats()); Console.WriteLine("Another compaction needed"); } Console.WriteLine(kdb.CalcStats()); } break; } case "export": { using (var dfc = new OnDiskFileCollection(args[0])) using (var kdb = new KeyValueDB(dfc)) using (var tr = kdb.StartReadOnlyTransaction()) using (var st = File.Create(Path.Combine(args[0], "export.dat"))) { KeyValueDBExportImporter.Export(tr, st); } break; } default: { Console.WriteLine($"Unknown action: {action}"); break; } } }
public ObjectDBTransaction(ObjectDB owner, IKeyValueDBTransaction keyValueTr) { _owner = owner; _keyValueTr = keyValueTr; _valid = true; }
public SingletonPersonTest(ObjectDB db, int count) { _db = db; _count = count; }
public RelationPersonTest(ObjectDB db, int count) { _count = count; _db = db; using (var tr = _db.StartTransaction()) { _creator = tr.InitRelation<IPersonTable>("Job"); } }