Exemple #1
0
			/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
			public FileBin(BinConfiguration config)
			{
				bool ok = false;
				try
				{
					_path = new Sharpen.IO.File(config.Uri()).GetCanonicalPath();
					_file = RandomAccessFileFactory.NewRandomAccessFile(_path, config.ReadOnly(), config
						.LockFile());
					if (config.InitialLength() > 0)
					{
						Write(config.InitialLength() - 1, new byte[] { 0 }, 1);
					}
					ok = true;
				}
				catch (IOException e)
				{
					throw new Db4oIOException(e);
				}
				finally
				{
					if (!ok)
					{
						Close();
					}
				}
			}
            /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
            public FileBin(BinConfiguration config)
            {
                bool ok = false;

                try
                {
                    _path = new Sharpen.IO.File(config.Uri()).GetCanonicalPath();
                    _file = RandomAccessFileFactory.NewRandomAccessFile(_path, config.ReadOnly(), config
                                                                        .LockFile());
                    if (config.InitialLength() > 0)
                    {
                        Write(config.InitialLength() - 1, new byte[] { 0 }, 1);
                    }
                    ok = true;
                }
                catch (IOException e)
                {
                    throw new Db4oIOException(e);
                }
                finally
                {
                    if (!ok)
                    {
                        Close();
                    }
                }
            }
Exemple #3
0
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		public virtual IBin Open(BinConfiguration config)
		{
			IoAdapterStorage.IoAdapterBin bin = new IoAdapterStorage.IoAdapterBin(_io.Open(config
				.Uri(), config.LockFile(), config.InitialLength(), config.ReadOnly()));
			((IBlockSize)Environments.My(typeof(IBlockSize))).Register(bin);
			return bin;
		}
Exemple #4
0
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        public virtual IBin Open(BinConfiguration config)
        {
            var bin = new IoAdapterBin(_io.Open(config
                                                .Uri(), config.LockFile(), config.InitialLength(), config.ReadOnly()));

            ((IBlockSize)Environments.My(typeof(IBlockSize))).Register(bin);
            return(bin);
        }
        	private IsolatedStorageFileStream OpenFile(BinConfiguration config, IsolatedStorageFile store)
        	{
        		_fullPath = config.Uri();
        		string path = config.Uri();
        		IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileModeFor(store, path), FileAccessFor(config), FileShareFor(config), store);
        		Fill(stream, config.InitialLength(), 0);

				return stream;
        	}
Exemple #6
0
        private IsolatedStorageFileStream OpenFile(BinConfiguration config, IsolatedStorageFile store)
        {
            _fullPath = config.Uri();
            string path = config.Uri();
            IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileModeFor(store, path), FileAccessFor(config), FileShareFor(config), store);

            Fill(stream, config.InitialLength(), 0);

            return(stream);
        }
		private IBin ProduceBin(BinConfiguration config)
		{
			IBin storage = Bin(config.Uri());
			if (null != storage)
			{
				return storage;
			}
			IBin newStorage = new PagingMemoryBin(_pageSize, config.InitialLength());
			_binsByUri[config.Uri()] = newStorage;
			return newStorage;
		}
Exemple #8
0
		private IBin ProduceStorage(BinConfiguration config)
		{
			IBin storage = Bin(config.Uri());
			if (null != storage)
			{
				return storage;
			}
			MemoryBin newStorage = new MemoryBin(new byte[(int)config.InitialLength()], _growthStrategy
				);
			_bins[config.Uri()] = newStorage;
			return newStorage;
		}
Exemple #9
0
        private IBin ProduceBin(BinConfiguration config)
        {
            var storage = Bin(config.Uri());

            if (null != storage)
            {
                return(storage);
            }
            IBin newStorage = new PagingMemoryBin(_pageSize, config.InitialLength());

            _binsByUri[config.Uri()] = newStorage;
            return(newStorage);
        }
Exemple #10
0
        private IBin ProduceStorage(BinConfiguration config)
        {
            IBin storage = Bin(config.Uri());

            if (null != storage)
            {
                return(storage);
            }
            MemoryBin newStorage = new MemoryBin(new byte[(int)config.InitialLength()], _growthStrategy
                                                 );

            _bins[config.Uri()] = newStorage;
            return(newStorage);
        }
		private BinConfiguration PointToNewUri(BinConfiguration oldConfig, string newUri)
		{
			return new BinConfiguration(newUri, oldConfig.LockFile(), oldConfig.InitialLength
				(), oldConfig.ReadOnly());
		}
Exemple #12
0
 private BinConfiguration PointToNewUri(BinConfiguration oldConfig, string newUri)
 {
     return(new BinConfiguration(newUri, oldConfig.LockFile(), oldConfig.InitialLength
                                     (), oldConfig.ReadOnly()));
 }
Exemple #13
0
		protected virtual IBin ProduceBin(BinConfiguration config, int pageSize)
		{
			return new PagingMemoryBin(pageSize, config.InitialLength());
		}
Exemple #14
0
 protected virtual IBin ProduceBin(BinConfiguration config, int pageSize)
 {
     return(new PagingMemoryBin(pageSize, config.InitialLength()));
 }