# The C# Database embeded class Parameters

### For an overview see page C# Classes

### Embeded class Parameters:

            /// Parameters for the database open method.
            ///
            public class Parameters
            {
                /// Memory page size (default: 256). When using a disk database, this
                /// should be a power of two and at least 8 times smaller than disk page
                /// size.
                ///
                public int MemPageSize;

                /// Disk page size (default: 0). Typically 4096 bytes; zero for
                /// all-in-memory databases.
                ///
                public int DiskPageSize;

                /// The maximum number of database connections (default: 100).
                ///
                public int MaxConnections;

                /// Recovery connection context (default: 0 - no recovery connection context)
                ///
                public int ConnectionContextSize;

                /// The maximum size for a disk database (default: 0 - unlimited).
                ///
                public long MaxDiskDatabaseSize;

                /// Quantum of increasing size of database file (can help to reduce file fragmentation)
                ///
                public long DiskFileExtensionQuantum;

                /// The REDO transaction log threshold. After reaching this a checkpoint
                /// is performed and the log is truncated. Note that the checkpoint can
                /// be performed only after a transaction commit, so the size of the log
                /// file can become larger than the specified limit. A zero value means
                /// to use the implementation specific default value.
                ///
                public long RedoLogLimit;

                /// The maximum size of uncommitted changes (delayed transaction commits)
                /// when using the CommitPolicy.Delayed policy (default: 0 - 1/3 of the
                /// available disk cache).
                ///
                public long DelayedCommitThreshold;

                /// The maximum number of delayed transaction commits when using the
                /// CommitPolicy.Delayed policy (default: 0 - unlimited).
                ///
                public int MaxDelayedTransactions;

                /// Default commit policy for new connections (default : CommitPolicy.SyncFlush)
                ///
                public Database.CommitPolicy DefaultCommitPolicy;

                /// The transaction log type (default: LogType.RedoLog).
                ///
                public Database.LogType LogType;

                /// The hash table load factor (default: 100%). This is a criterion for
                /// hash table extension.
                ///
                public int HashLoadFactor;

                /// The maximum number of active write transactions when using optimistic
                /// locking of B-Tree indexes (default: 0 - unlimited).
                ///
                public int IndexOptimisticLockThreshold;

                /// A combination of DB_MODE_/// bits (default: 0).
                ///
                public int Mode;

                /// The path to the file from which a database snapshot will be loaded at
                /// open time (default: null - no snapshot to load).
                ///
                public String DatabaseSnapshotFilePath;

                /// The default string encoding (string encoding can be specified using
                /// the Encoding attribute for each field separately) (default: UTF-8).
                ///
                public String StringEncoding;

                /// The classes to be stored in the database. Only instances of the
                /// classes listed can be stored in the database. This parameter has no
                /// default value and must be explicitly specified by the application.
                ///
                public Type[] Classes;

                /// Whether the classes specified in classes will be stored
                /// on disk. Also disk classes may be marked explicitly using the disk()
                /// attribute of the Persistent attribute.
                ///
                public bool DiskClassesByDefault;

                /// Whether classes specified in classes will be implicitly
                /// marked as compact. Also compact classes may be marked
                /// explicitly using the compact() attribute of Persistent attribute.
                ///
                public bool CompactClassesByDefault;

                /// Whether classes specified in classes will be implicitly marked as nonatomic. Also nonatomic classes may be marked
                /// explicitly using the compact() attribute of Persistent attribute.
                ///
                public bool  NonAtomicClassesByDefault;

                /// Make dictionary compatible with mcocomp utility called with -nosort option
                ///
                public bool DictionaryNoSort;

                /// Maximal number of classes in database.
                /// Is need for dynamic schema evolution
                public int MaxClasses;

                /// Maximal number of indexes in database.
                /// Is need for dynamic schema evolution
                public int MaxIndexes;

                /// Maximal size of database dictionary
                /// Is need for dynamic schema evolution
                public int MaxDictionarySize;

                public ClusterParams ClusterParameters;

                /// Whether eXtremeDB runtime terminates current process
                /// in case of fatal error appeared.
                public bool TerminateOnFatalError;

                /// Scheduling policy for transactions with the same priority
                public TransSchedPolicy SchedPolicy;

                /// Ignore all TTL policies (can be changed at runtime)
                public bool IgnoreTtl;

                ///  SQL workspace quota. Default is 0 - unlimited
                public long sqlWorkspaceLimit;

                ///  compression level: 0..9, 0 - no compression, -1: default compression level
                public int CompressionLevel;

                ///  bitmap of page kinds which should be compressed
                public Compression CompressionMask;

                ///  use to allocate page map: virtual database space can not be larger than physical size compression ratio
                public int ExpectedCompressionRatio;

                ///  database encryption key
                ///  It manages all kinds of encryption if cipher_key_snapshot_tl is 0. Else, cipher_key manages only an encryption
                ///  of persistent (disk) DB files or IM DB pages.
                public String CipherKey;

                ///  DB snapshot or TL encryption key (mco_db_params_t::cipher_key_snapshot_tl), string
                ///  It overrides encryption key specified by cipher_key for a database snapshot
                ///  (mco_db_save[class_save] and mco_db_load[class_load]) or a transaction log (TL) apart from
                ///  persistent DB files and IM DB pages encryption if cipher_key is not 0. Else manages
                ///  only an encryption of a database snapshot or TL, leaving persistent DB files and IM DB
                ///  pages unencrypted. Assign an empty string "" to specify that a database snapshot and TL
                ///  are not encrypted, whilst cipher_key  specifies an encryption for persistent DB files or IM pages.
                public String CipherKeySnapshotTL;

                ///  size of backup counters array, bytes, power of two, ignored if disk_max_database_size set. Default is 0 - disable backup feature
                public long BackupMapSize;

                ///  number of pages for last exclusive pass of backup procedure, set to zero to disable treshold. Default is 0
                public int BackupMinPages;

                /// Max number of passes before exclusive pass of backup procedure. Default is 10
                public int BackupMaxPasses;

                /// Name of a file will be used to store backup temporary data on mco_db_close() call.
                /// Optional, set to null for default "<persistent-storage>.bmap" file locate at the same location as persistent storage file
                public String BackupMapFile;

                ///  Delay in milliseconds between writing backup blocks to minimize backup impact on performance
                public int FileBackupDelay;

                ///  Estimated total number of objects in the database (used for global system hash table size estimation)
                public long EstimatedNumberOfObjects;

                /// Constructor with default values
                public Parameters()
                {
                    MemPageSize = 256;
                    DiskPageSize = 4096;
                    MaxConnections = 100;
                    ConnectionContextSize = 0;
                    MaxDiskDatabaseSize = 0;
                    DiskFileExtensionQuantum = 0;
                    RedoLogLimit = 16*1024*1024;
                    DelayedCommitThreshold = 0;
                    MaxDelayedTransactions = 0;
                    DefaultCommitPolicy = CommitPolicy.SyncFlush;
                    LogType = LogType.RedoLog;
                    HashLoadFactor = 100;
                    IndexOptimisticLockThreshold = 100;
                    StringEncoding = MULTIBYTE_ENCODING;
                    TerminateOnFatalError = false;
                    SchedPolicy = TransSchedPolicy.Fifo;
                    IgnoreTtl = false;
                    sqlWorkspaceLimit = 0;
                    CompressionLevel = -1;
                    CompressionMask = Compression.All;
                    ExpectedCompressionRatio = 10;
                    BackupMapSize = 0;
                    BackupMinPages = 0;
                    BackupMaxPasses = 10;
                    BackupMapFile = null;
                    EstimatedNumberOfObjects = 10000;
                }

                [Flags]
                public enum Compression
                {
                    ObjHead     = 1,
                    ObjNode     = 2,
                    BlobHead    = 64,
                    BlobTail    = 128,
                    FixedrecSet = 4096,
                    All = ObjHead | ObjNode | FixedrecSet | BlobHead | BlobTail
                }
            }