public Client(BD2.Daemon.TransparentAgent agent, BD2.Chunk.ChunkRepository repo, string databaseName) { if (agent == null) { throw new ArgumentNullException("agent"); } if (repo == null) { throw new ArgumentNullException("repo"); } if (databaseName == null) { throw new ArgumentNullException("databaseName"); } this.agent = agent; this.repo = repo; this.databaseName = databaseName; typeIDs = new Dictionary <Type, long> (); typeIDs.Add(typeof(bool), 1); typeIDs.Add(typeof(char), 2); typeIDs.Add(typeof(byte), 3); typeIDs.Add(typeof(byte[]), 4); typeIDs.Add(typeof(short), 5); typeIDs.Add(typeof(int), 6); typeIDs.Add(typeof(long), 7); typeIDs.Add(typeof(float), 8); typeIDs.Add(typeof(double), 9); typeIDs.Add(typeof(Guid), 10); typeIDs.Add(typeof(String), 11); typeIDs.Add(typeof(DateTime), 12); tableDataRequests = new SortedDictionary <Guid, Table> (); frontend = new BD2.Frontend.Table.Frontend(new BD2.Frontend.Table.GenericValueDeserializer()); frontends = new BD2.Core.FrontendBase[] { frontend }; db = new BD2.Core.Database(new BD2.Chunk.ChunkRepository[] { repo }, frontends, new byte[] { }, databaseName); ss = db.GetSnapshot("Primary"); frontendInstance = (BD2.Frontend.Table.FrontendInstance)frontend.GetInstanse(ss); tableColumns = new System.Collections.Concurrent.ConcurrentDictionary <Table, System.Collections.Concurrent.BlockingCollection <Column> > (); tables = new SortedDictionary <Guid, Tuple <Table, List <Column> > > (); }
public static void Main(string[] args) { typeof(BD2.Frontend.Table.Row).GetCustomAttributes(true); typeof(BD2.Frontend.Table.Table).GetCustomAttributes(true); typeof(BD2.Frontend.Table.Relation).GetCustomAttributes(true); typeof(BD2.Frontend.Table.Column).GetCustomAttributes(true); typeof(BD2.Frontend.Table.ColumnSet).GetCustomAttributes(true); string databaseName = "Esfand"; BD2.Core.Database db = new BD2.Core.Database(new BD2.Chunk.ChunkRepository[] { new BD2.Repo.Leveldb.Repository("/home/behrooz/Test") }, new BD2.Core.FrontendBase[] { new BD2.Frontend.Table.Frontend(new BD2.Frontend.Table.GenericValueDeserializer()) }, new byte[] { }, databaseName); BD2.Frontend.Table.FrontendInstance frontendInstance = (BD2.Frontend.Table.FrontendInstance)(db.GetFrontend("BD2.Frontend.Table")).GetInstanse(db.GetSnapshot("Primary")); //use the db here BD2.Frontend.Table.Table M = (BD2.Frontend.Table.Table)frontendInstance.GetTable("Moshtary"); foreach (var R in frontendInstance.GetRows(M)) { object[] values = R.GetValues(); values [0] = null; frontendInstance.CreateRow(M, R.ColumnSet, new byte[][] { R.ObjectID }, values); } // frontendInstance.Flush(); }
public Client(BD2.Daemon.TransparentAgent agent, BD2.Chunk.ChunkRepository repo, string databaseName) { if (agent == null) throw new ArgumentNullException ("agent"); if (repo == null) throw new ArgumentNullException ("repo"); if (databaseName == null) throw new ArgumentNullException ("databaseName"); this.agent = agent; this.repo = repo; this.databaseName = databaseName; typeIDs = new Dictionary<Type, long> (); typeIDs.Add (typeof(bool), 1); typeIDs.Add (typeof(char), 2); typeIDs.Add (typeof(byte), 3); typeIDs.Add (typeof(byte[]), 4); typeIDs.Add (typeof(short), 5); typeIDs.Add (typeof(int), 6); typeIDs.Add (typeof(long), 7); typeIDs.Add (typeof(float), 8); typeIDs.Add (typeof(double), 9); typeIDs.Add (typeof(Guid), 10); typeIDs.Add (typeof(String), 11); typeIDs.Add (typeof(DateTime), 12); tableDataRequests = new SortedDictionary<Guid, Table> (); frontend = new BD2.Frontend.Table.Frontend (new BD2.Frontend.Table.GenericValueDeserializer ()); frontends = new BD2.Core.FrontendBase[] { frontend }; db = new BD2.Core.Database (new BD2.Chunk.ChunkRepository[] { repo }, frontends, new byte[]{ }, databaseName); ss = db.GetSnapshot ("Primary"); frontendInstance = (BD2.Frontend.Table.FrontendInstance)frontend.GetInstanse (ss); tableColumns = new System.Collections.Concurrent.ConcurrentDictionary<Table, System.Collections.Concurrent.BlockingCollection<Column>> (); tables = new SortedDictionary<Guid, Tuple<Table, List<Column>>> (); }