示例#1
0
        /// <summary>Create a new Database instance from a database handler</summary>
        /// <param name="cluster">Parent cluster</param>
        /// <param name="handler">Handle to the native FDB_DATABASE*</param>
        /// <param name="name">Name of the database</param>
        /// <param name="contentSubspace">Subspace of the all keys accessible by this database instance</param>
        /// <param name="directory">Root directory of the database instance</param>
        /// <param name="readOnly">If true, the database instance will only allow read-only transactions</param>
        /// <param name="ownsCluster">If true, the cluster instance lifetime is linked with the database instance</param>
        public static FdbDatabase Create([NotNull] IFdbCluster cluster, [NotNull] IFdbDatabaseHandler handler, string name, [NotNull] IKeySubspace contentSubspace, IFdbDirectory directory, bool readOnly, bool ownsCluster)
        {
            Contract.NotNull(cluster, nameof(cluster));
            Contract.NotNull(handler, nameof(handler));
            Contract.NotNull(contentSubspace, nameof(contentSubspace));

            return(new FdbDatabase(cluster, handler, name, contentSubspace, directory, readOnly, ownsCluster));
        }
示例#2
0
        /// <summary>Create a new database instance</summary>
        /// <param name="cluster">Parent cluster</param>
        /// <param name="handler">Handle to the native FDB_DATABASE*</param>
        /// <param name="name">Name of the database</param>
        /// <param name="contentSubspace">Subspace of the all keys accessible by this database instance</param>
        /// <param name="directory">Root directory of the database instance</param>
        /// <param name="readOnly">If true, the database instance will only allow read-only transactions</param>
        /// <param name="ownsCluster">If true, the cluster instance lifetime is linked with the database instance</param>
        protected FdbDatabase(IFdbCluster cluster, IFdbDatabaseHandler handler, string name, IKeySubspace contentSubspace, IFdbDirectory directory, bool readOnly, bool ownsCluster)
        {
            Contract.Requires(cluster != null && handler != null && name != null && contentSubspace != null);

            m_cluster     = cluster;
            m_handler     = handler;
            m_name        = name;
            m_readOnly    = readOnly;
            m_ownsCluster = ownsCluster;
            ChangeRoot(contentSubspace, directory, readOnly);
        }
        /// <summary>Create a new Database instance from a database handler</summary>
        /// <param name="cluster">Parent cluster</param>
        /// <param name="handler">Handle to the native FDB_DATABASE*</param>
        /// <param name="name">Name of the database</param>
        /// <param name="contentSubspace">Subspace of the all keys accessible by this database instance</param>
        /// <param name="directory">Root directory of the database instance</param>
        /// <param name="readOnly">If true, the database instance will only allow read-only transactions</param>
        /// <param name="ownsCluster">If true, the cluster instance lifetime is linked with the database instance</param>
        public static FdbDatabase Create(IFdbCluster cluster, IFdbDatabaseHandler handler, string name, FdbSubspace contentSubspace, IFdbDirectory directory, bool readOnly, bool ownsCluster)
        {
            if (cluster == null)
            {
                throw new ArgumentNullException("cluster");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            if (contentSubspace == null)
            {
                throw new ArgumentNullException("contentSubspace");
            }

            return(new FdbDatabase(cluster, handler, name, contentSubspace, directory, readOnly, ownsCluster));
        }
 private MemoryDatabase(IFdbCluster cluster, MemoryDatabaseHandler handler, string name, IFdbSubspace globalSpace, IFdbDirectory directory, bool readOnly, bool ownsCluster)
     : base(cluster, handler, name, globalSpace, directory, readOnly, ownsCluster)
 {
     m_handler = handler;
 }
		private MemoryDatabase(IFdbCluster cluster, MemoryDatabaseHandler handler, string name, IFdbSubspace globalSpace, IFdbDirectory directory, bool readOnly, bool ownsCluster)
			: base(cluster, handler, name, globalSpace, directory, readOnly, ownsCluster)
		{
			m_handler = handler;
		}