예제 #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();
                    }
                }
            }
예제 #2
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;
		}
예제 #3
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();
					}
				}
			}
예제 #4
0
		/// <summary>opens a Bin for the given URI.</summary>
		/// <remarks>opens a Bin for the given URI.</remarks>
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		public override IBin Open(BinConfiguration config)
		{
			IBin storage = base.Open(config);
			if (config.ReadOnly())
			{
				return new ReadOnlyBin(new CachingStorage.NonFlushingCachingBin(storage, NewCache
					(), _pageCount, _pageSize));
			}
			return new CachingBin(storage, NewCache(), _pageCount, _pageSize);
		}
예제 #5
0
        /// <summary>opens a Bin for the given URI.</summary>
        /// <remarks>opens a Bin for the given URI.</remarks>
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        public override IBin Open(BinConfiguration config)
        {
            IBin storage = base.Open(config);

            if (config.ReadOnly())
            {
                return(new ReadOnlyBin(new CachingStorage.NonFlushingCachingBin(storage, NewCache
                                                                                    (), _pageCount, _pageSize)));
            }
            return(new CachingBin(storage, NewCache(), _pageCount, _pageSize));
        }
예제 #6
0
		private BinConfiguration PointToNewUri(BinConfiguration oldConfig, string newUri)
		{
			return new BinConfiguration(newUri, oldConfig.LockFile(), oldConfig.InitialLength
				(), oldConfig.ReadOnly());
		}
예제 #7
0
 private BinConfiguration PointToNewUri(BinConfiguration oldConfig, string newUri)
 {
     return(new BinConfiguration(newUri, oldConfig.LockFile(), oldConfig.InitialLength
                                     (), oldConfig.ReadOnly()));
 }
예제 #8
0
		/// <summary>opens a MemoryBin for the given URI (name can be freely chosen).</summary>
		/// <remarks>opens a MemoryBin for the given URI (name can be freely chosen).</remarks>
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		public virtual IBin Open(BinConfiguration config)
		{
			IBin storage = ProduceStorage(config);
			return config.ReadOnly() ? new ReadOnlyBin(storage) : storage;
		}
예제 #9
0
 private static FileAccess FileAccessFor(BinConfiguration config)
 {
     return(config.ReadOnly() ? FileAccess.Read : FileAccess.ReadWrite);
 }
예제 #10
0
        /// <summary>opens a MemoryBin for the given URI (name can be freely chosen).</summary>
        /// <remarks>opens a MemoryBin for the given URI (name can be freely chosen).</remarks>
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        public virtual IBin Open(BinConfiguration config)
        {
            IBin storage = ProduceStorage(config);

            return(config.ReadOnly() ? new ReadOnlyBin(storage) : storage);
        }
예제 #11
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);
 }
예제 #12
0
        /// <summary>opens a MemoryBin for the given URI (name can be freely chosen).</summary>
        /// <remarks>opens a MemoryBin for the given URI (name can be freely chosen).</remarks>
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        public virtual IBin Open(BinConfiguration config)
        {
            var bin = ProduceBin(config);

            return(config.ReadOnly() ? new ReadOnlyBin(bin) : bin);
        }
예제 #13
0
		/// <summary>opens a MemoryBin for the given URI (name can be freely chosen).</summary>
		/// <remarks>opens a MemoryBin for the given URI (name can be freely chosen).</remarks>
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		public virtual IBin Open(BinConfiguration config)
		{
			IBin bin = AcquireBin(config);
			return config.ReadOnly() ? new ReadOnlyBin(bin) : bin;
		}
예제 #14
0
        /// <summary>opens a MemoryBin for the given URI (name can be freely chosen).</summary>
        /// <remarks>opens a MemoryBin for the given URI (name can be freely chosen).</remarks>
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        public virtual IBin Open(BinConfiguration config)
        {
            IBin bin = AcquireBin(config);

            return(config.ReadOnly() ? new ReadOnlyBin(bin) : bin);
        }
예제 #15
0
 	private static FileAccess FileAccessFor(BinConfiguration config)
 	{
 		return config.ReadOnly() ? FileAccess.Read : FileAccess.ReadWrite;
 	}
예제 #16
0
 /// <summary>opens a MemoryBin for the given URI (name can be freely chosen).</summary>
 /// <remarks>opens a MemoryBin for the given URI (name can be freely chosen).</remarks>
 /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
 public virtual IBin Open(BinConfiguration config)
 {
     var bin = ProduceBin(config);
     return config.ReadOnly() ? new ReadOnlyBin(bin) : bin;
 }