public NoSqlColoredTransactionRepository(ITransactionRepository transactionRepository, NoSqlRepository repository)
		{
			if(transactionRepository == null)
				transactionRepository = new NoSqlTransactionRepository();
			if(repository == null)
				repository = new InMemoryNoSqlRepository();
			_Transactions = transactionRepository;
			_Repository = repository;
		}
 public IndexedBlockStore(NoSqlRepository index, BlockStore store)
 {
     if(index == null)
         throw new ArgumentNullException("index");
     if(store == null)
         throw new ArgumentNullException("store");
     _Index = index;
     _Store = store;
 }
Beispiel #3
0
 protected IndexedStore(NoSqlRepository index, Store <TStoredItem, TItem> store)
 {
     if (index == null)
     {
         throw new ArgumentNullException("index");
     }
     if (store == null)
     {
         throw new ArgumentNullException("store");
     }
     _Index = index;
     _Store = store;
 }
Beispiel #4
0
 public NoSqlColoredTransactionRepository(ITransactionRepository transactionRepository, NoSqlRepository repository)
 {
     if (transactionRepository == null)
     {
         transactionRepository = new NoSqlTransactionRepository();
     }
     if (repository == null)
     {
         repository = new InMemoryNoSqlRepository();
     }
     _Transactions = transactionRepository;
     _Repository   = repository;
 }
Beispiel #5
0
        public NoSqlColoredTransactionRepository(Network network, ITransactionRepository transactionRepository,
                                                 NoSqlRepository noSqlRepository)
        {
            if (transactionRepository == null)
            {
                transactionRepository = new NoSqlTransactionRepository(network);
            }

            if (noSqlRepository == null)
            {
                noSqlRepository = new InMemoryNoSqlRepository(network);
            }

            this.Transactions = transactionRepository;
            this.Repository   = noSqlRepository;
        }
Beispiel #6
0
        public void CanStoreInNoSql()
        {
            var repositories = new NoSqlRepository[]
            {
                CreateNoSqlRepository(),
                new InMemoryNoSqlRepository(),
                new CachedNoSqlRepository(CreateNoSqlRepository("CanStoreInNoSqlCached"))
            };

            foreach (var repository in repositories)
            {
                byte[] data1 = new byte[] { 1, 2, 3, 4, 5, 6 };
                byte[] data2 = new byte[] { 11, 22, 33, 4, 5, 66 };
                Assert.Null(repository.Get <RawData>("data1"));

                repository.Put("data1", new RawData(data1));
                var actual = repository.Get <RawData>("data1");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data1);

                repository.Put("data1", new RawData(data2));
                actual = repository.Get <RawData>("data1");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data2);

                repository.Put("data1", null as RawData);
                actual = repository.Get <RawData>("data1");
                Assert.Null(actual);

                repository.Put("data1", null as RawData);
                actual = repository.Get <RawData>("data1");
                Assert.Null(actual);

                //Test batch
                repository.PutBatch(new[] { new Tuple <string, IBitcoinSerializable>("data1", new RawData(data1)),
                                            new Tuple <string, IBitcoinSerializable>("data2", new RawData(data2)) });

                actual = repository.Get <RawData>("data1");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data1);

                actual = repository.Get <RawData>("data2");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data2);
            }
        }
 public IndexedBlockStore(NoSqlRepository index, BlockStore store)
     : base(index, store)
 {
     _Store       = store;
     IndexedLimit = "Last Index Position";
 }
Beispiel #8
0
		public CoinsView(NoSqlRepository index)
		{
			if(index == null)
				throw new ArgumentNullException("index");
			_Index = index;
		}
Beispiel #9
0
 public IndexedBlockUndoStore(NoSqlRepository index, BlockUndoStore store)
     : base(index, store)
 {
     _Store       = store;
     IndexedLimit = "BlockUndo Index";
 }
Beispiel #10
0
        public void CanStoreInNoSql()
        {
            var repositories = new NoSqlRepository[]
            {
                CreateNoSqlRepository(),
                new InMemoryNoSqlRepository(),
                new CachedNoSqlRepository(CreateNoSqlRepository("CanStoreInNoSqlCached"))
            };

            foreach(var repository in repositories)
            {
                byte[] data1 = new byte[] { 1, 2, 3, 4, 5, 6 };
                byte[] data2 = new byte[] { 11, 22, 33, 4, 5, 66 };
                Assert.Null(repository.Get<RawData>("data1"));

                repository.Put("data1", new RawData(data1));
                var actual = repository.Get<RawData>("data1");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data1);

                repository.Put("data1", new RawData(data2));
                actual = repository.Get<RawData>("data1");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data2);

                repository.Put("data1", null as RawData);
                actual = repository.Get<RawData>("data1");
                Assert.Null(actual);

                repository.Put("data1", null as RawData);
                actual = repository.Get<RawData>("data1");
                Assert.Null(actual);

                //Test batch
                repository.PutBatch(new[] {new Tuple<string,IBitcoinSerializable>("data1",new RawData(data1)),
                                       new Tuple<string,IBitcoinSerializable>("data2",new RawData(data2))});

                actual = repository.Get<RawData>("data1");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data1);

                actual = repository.Get<RawData>("data2");
                Assert.NotNull(actual);
                AssertEx.CollectionEquals(actual.Data, data2);
            }
        }
		public NoSqlTransactionRepository(NoSqlRepository repository)
		{
			if(repository == null)
				throw new ArgumentNullException("repository");
			_Repository = repository;
		}
Beispiel #12
0
 public CoinsView(NoSqlRepository noSqlRepository)
 {
     this.NoSqlRepository = noSqlRepository ?? throw new ArgumentNullException(nameof(noSqlRepository));
 }
Beispiel #13
0
 public CoinsView(NoSqlRepository index)
 {
     this.index = index ?? throw new ArgumentNullException("index");
 }
 public CachedNoSqlRepository(NoSqlRepository inner)
 {
     _InnerRepository = inner;
 }
Beispiel #15
0
        static void Main(string[] args)
        {
            try
            {
                YoIt f**k = new YoIt();
                f**k.Yo();

                DbInitializationTools.DbInitializerStrategyFactory("CreateIfChanged");

                Console.WriteLine("Clear database?");
                var instruction = Console.ReadKey();
                if (instruction.Key == ConsoleKey.Y)
                {
                    using (var context = new NoSQLContext())
                    {
                        context.Database.ExecuteSqlCommand("Delete from Store");
                        context.Database.ExecuteSqlCommand("Delete from typeversion");
                        context.Database.ExecuteSqlCommand("Delete from StoreArchive");
                    }
                }

                //DoIt();
                //MigrationsFuck();
                //return;

                // Temp test of the system
                Guid id1, id2;
                using (var context = new NoSQLContext())
                {
                    NoSqlRepository s = new NoSqlRepository(context);

                    id1 = s.Create(@"P&P test 1");
                    id2 = s.Create(@"P&P test 2");

                    context.SaveChanges();
                }

                using (var context = new NoSQLContext())
                {
                    NoSqlRepository <string> s = new NoSqlRepository <string>(context);

                    var foo = s.Retrieve(id1);
                    var bar = s.Retrieve(id2);

                    Console.WriteLine(foo);
                    Console.WriteLine(bar);
                }

                using (var store = new Store())
                {
                    var one = BuildMeOne();

                    store.Create(one);

                    store.SaveChanges();
                }

                using (var store = new Store())
                {
                    var readBack = store.TryRetrieve <SimplePoco>(new Guid("DA722261-062C-43DF-B64C-B17829A58440"));

                    var yo = 3334;
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }

            Console.ReadKey();
        }