/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace BerkeleyDB {
///
/// A class representing configuration parameters for
///
///
public class HeapDatabaseConfig : DatabaseConfig {
///
/// The path of the directory where blobs are stored.
///
/// If the database is opened within ,
/// this path setting will be ignored during
/// . Use
/// to identify the current storage
/// location of blobs after opening the database.
///
///
public string BlobDir;
internal bool blobThresholdIsSet;
private uint blobThreshold;
///
/// The size in bytes which is used to determine when a data item
/// will be stored as a blob.
///
/// Any data item that is equal to or larger in size than the
/// threshold value is automatically stored as a blob.
///
///
/// If the threshold value is 0, blobs are never used by the
/// database.
///
///
/// It is illegal to enable blob support in the database which is configured
/// as in-memory database or with chksum, encryption, duplicates,
/// sorted duplicates, compression, multiversion concurrency control
/// and transactional read operations with degree 1 isolation.
///
///
public uint BlobThreshold {
get { return blobThreshold; }
set {
blobThresholdIsSet = true;
blobThreshold = value;
}
}
///
/// The policy for how to handle database creation.
///
///
/// If the database does not already exist and
/// is set,
/// fails.
///
public CreatePolicy Creation;
internal new uint openFlags {
get {
uint flags = base.openFlags;
flags |= (uint)Creation;
return flags;
}
}
private uint _gbytes;
private uint _bytes;
internal bool maxSizeIsSet;
///
/// The gigabytes component of the maximum on-disk database file size.
///
public uint MaxSizeGBytes { get { return _gbytes; } }
///
/// The bytes component of the maximum on-disk database file size.
///
public uint MaxSizeBytes { get { return _bytes; } }
///
/// Set the maximum on-disk database file size used by the database. Attempts
/// to update or create records in a database that have reached this file size
/// limit throw a . If this value is not set,
/// the database file size can grow infinitely.
///
///
/// The size specified must be at least three times the
/// database page size. The database must contain at least
/// three database pages. You can set the database page size using
/// .
///
/// If this value is set for an existing database, the size specified
/// here must match the size used to create the database. Specifying an
/// incorrect size does not result in an error until the database is opened.
///
/// The size of the database is set to GBytes
/// gigabytes plus Bytes.
/// The size of the database is set to GBytes
/// gigabytes plus Bytes.
public void MaxSize(uint GBytes, uint Bytes) {
maxSizeIsSet = true;
_gbytes = GBytes;
_bytes = Bytes;
}
private uint _regionsz;
internal bool regionszIsSet;
///
/// The number of pages in a region of the database. If this value is
/// never set, the default region size for the database's page size is
/// used. You can set the database page size using
/// .
///
/// If the database already exists, this value is ignored. If the
/// specified region size is larger than the maximum region size for the
/// database's page size, an error is returned when
/// is called. The maximum allowable region
/// size is included in the error message.
///
public uint RegionSize {
get { return _regionsz; }
set {
_regionsz = value;
regionszIsSet = true;
}
}
///
/// Instantiate a new HeapDatabaseConfig object
///
public HeapDatabaseConfig() {
blobThresholdIsSet = false;
Creation = CreatePolicy.NEVER;
}
}
}