コード例 #1
0
        /// <summary>
        /// Creates a new bucket.
        /// </summary>
        /// <param name="conn">A <see cref="Connection"/> or <see cref="ConnectionPool"/></param>
        /// <param name="databaseName">The database name to use. The database must exist.</param>
        /// <param name="bucketName">The bucket name to use.</param>
        /// <param name="config">Low level bucket configuration options.</param>
        public Bucket(IConnection conn, string databaseName, string bucketName = "fs", BucketConfig config = null)
        {
            this.conn = conn;

            this.databaseName = databaseName;
            this.db = R.Db(this.databaseName);

            config = config ?? new BucketConfig();

            this.tableCreateOpts = config.TableCreateOptions;

            this.fileTableName = $"{bucketName}_{config.FileTableName}";
            this.fileTable = this.db.Table(fileTableName);
            this.fileIndex = config.FileIndex;
            this.fileIndexPrefix = config.FileIndexPrefix;

            this.chunkTableName = $"{bucketName}_{config.ChunkTable}";
            this.chunkTable = this.db.Table(chunkTableName);
            this.chunkIndexName = config.ChunkIndex;
        }