상속: IObjectDB
예제 #1
0
 static ObjectDB CreateInMemoryDb()
 {
     var lowDb = new InMemoryKeyValueDB();
     var db = new ObjectDB();
     db.Open(lowDb, true);
     return db;
 }
예제 #2
0
 public ObjectDBTransaction(ObjectDB owner, IKeyValueDBTransaction keyValueTr, bool readOnly)
 {
     _owner             = owner;
     _keyValueTr        = keyValueTr;
     _readOnly          = readOnly;
     _transactionNumber = keyValueTr.GetTransactionNumber();
 }
예제 #3
0
 public RelationInfoResolver(ObjectDB objectDB)
 {
     FieldHandlerFactory    = objectDB.FieldHandlerFactory;
     TypeConvertorGenerator = objectDB.TypeConvertorGenerator;
     Container          = objectDB.ActualOptions.Container;
     FieldHandlerLogger = objectDB.FieldHandlerLogger;
 }
예제 #4
0
 static ObjectDB CreateDb(IFileCollection fc)
 {
     var lowDb = new KeyValueDB(fc);
     var db = new ObjectDB();
     db.Open(lowDb, true);
     return db;
 }
예제 #5
0
파일: Program.cs 프로젝트: tomasdeml/BTDB
 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);
         }
     }
 }
예제 #6
0
 internal TableInfoResolver(IKeyValueDB keyValueDB, ObjectDB objectDB)
 {
     _keyValueDB = keyValueDB;
     _objectDB   = objectDB;
 }
예제 #7
0
 void LoadRelationNamesDict()
 {
     _relationId2Name = ObjectDB.LoadRelationNamesEnum(_tr.KeyValueDBTransaction)
                        .ToDictionary(pair => pair.Key, pair => pair.Value);
 }
예제 #8
0
 void LoadTableNamesDict()
 {
     _tableId2Name = ObjectDB.LoadTablesEnum(_tr.KeyValueDBTransaction)
                     .ToDictionary(pair => pair.Key, pair => pair.Value);
 }
예제 #9
0
파일: RelationsInfo.cs 프로젝트: saryn/BTDB
 public RelationInfoResolver(ObjectDB objectDB)
 {
     _fieldHandlerFactory    = objectDB.FieldHandlerFactory;
     _typeConvertorGenerator = objectDB.TypeConvertorGenerator;
 }
예제 #10
0
파일: ObjectDB.cs 프로젝트: Bobris/BTDB
 internal TableInfoResolver(IKeyValueDB keyValueDB, ObjectDB objectDB)
 {
     _keyValueDB = keyValueDB;
     _objectDB = objectDB;
 }
예제 #11
0
파일: Program.cs 프로젝트: Bobris/BTDB
        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;
                    }
            }
        }
예제 #12
0
 public RelationInfoResolver(ObjectDB objectDB)
 {
     _fieldHandlerFactory = objectDB.FieldHandlerFactory;
     _typeConvertorGenerator = objectDB.TypeConvertorGenerator;
 }
예제 #13
0
 public ObjectDBTransaction(ObjectDB owner, IKeyValueDBTransaction keyValueTr)
 {
     _owner      = owner;
     _keyValueTr = keyValueTr;
     _valid      = true;
 }
예제 #14
0
 public SingletonPersonTest(ObjectDB db, int count)
 {
     _db = db;
     _count = count;
 }
예제 #15
0
 public RelationPersonTest(ObjectDB db, int count)
 {
     _count = count;
     _db = db;
     using (var tr = _db.StartTransaction())
     {
         _creator = tr.InitRelation<IPersonTable>("Job");
     }
 }