예제 #1
0
        /// <summary>Create a new Database instance from a database handler</summary>
        /// <param name="handler">Handle to the native FDB_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>
        public static FdbDatabase Create([NotNull] IFdbDatabaseHandler handler, [NotNull] IKeySubspace contentSubspace, [CanBeNull] IFdbDirectory directory, bool readOnly)
        {
            Contract.NotNull(handler, nameof(handler));
            Contract.NotNull(contentSubspace, nameof(contentSubspace));

            return(new FdbDatabase(handler, contentSubspace, directory, readOnly));
        }
예제 #2
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));
        }
        /// <summary>Create a new Database instance from a database handler</summary>
        /// <param name="handler">Handle to the native FDB_DATABASE*</param>
        /// <param name="directory">Directory Layer instance used by this database instance</param>
        /// <param name="root">Root location of the database</param>
        /// <param name="readOnly">If true, the database instance will only allow read-only transactions</param>
        public static FdbDatabase Create(IFdbDatabaseHandler handler, FdbDirectoryLayer directory, FdbDirectorySubspaceLocation root, bool readOnly)
        {
            Contract.NotNull(handler, nameof(handler));
            Contract.NotNull(directory, nameof(directory));
            Contract.NotNull(root, nameof(root));

            return(new FdbDatabase(handler, directory, root, readOnly));
        }
예제 #4
0
        /// <summary>Create a new database instance</summary>
        /// <param name="handler">Handle to the native FDB_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>
        protected FdbDatabase(IFdbDatabaseHandler handler, IKeySubspace contentSubspace, IFdbDirectory directory, bool readOnly)
        {
            Contract.Requires(handler != null && contentSubspace != null);

            m_handler  = handler;
            m_readOnly = readOnly;
            ChangeRoot(contentSubspace, directory, readOnly);
        }
        /// <summary>Create a new database instance</summary>
        /// <param name="handler">Handle to the native FDB_DATABASE*</param>
        /// <param name="root">Root location of this database</param>
        /// <param name="readOnly">If true, the database instance will only allow read-only transactions</param>
        protected FdbDatabase(IFdbDatabaseHandler handler, FdbDirectoryLayer directory, FdbDirectorySubspaceLocation root, bool readOnly)
        {
            Contract.Requires(handler != null && directory != null && root != null);

            m_handler   = handler;
            m_readOnly  = readOnly;
            m_root      = root;
            m_directory = directory;
        }
예제 #6
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));
        }