/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2009 Oracle. All rights reserved. * */ using System; using System.Collections.Generic; namespace BerkeleyDB { /// /// A function to call after the record number has been selected but before /// the data has been stored into the database. /// /// The data to be stored. /// The generated record number. public delegate void AppendRecordDelegate(DatabaseEntry data, uint recno); /// /// A function to store a compressed key/data pair into a supplied buffer. /// /// The key immediately preceding the application supplied key. /// The data associated with prevKey. /// The application supplied key. /// The application supplied data. /// The compressed data to be stored in the /// database. /// The number of compressed bytes written to /// , or the required size of /// , if too small. /// True on success, false if dest is too small to contain the /// compressed data. All other errors should throw an exception. public delegate bool BTreeCompressDelegate(DatabaseEntry prevKey, DatabaseEntry prevData, DatabaseEntry key, DatabaseEntry data, ref byte[] dest, out int size); /// /// A function to decompress a key/data pair from a supplied buffer. /// /// The key immediately preceding the key being decompressed. /// The data associated with prevKey. /// The data stored in the tree, that is, the compressed data. /// The number of bytes read from . /// Two new DatabaseEntry objects representing the decompressed /// key/data pair. public delegate KeyValuePair BTreeDecompressDelegate(DatabaseEntry prevKey, DatabaseEntry prevData, byte[] compressed, out uint bytesRead); /// /// The application-specified feedback function called to report Berkeley DB /// operation progress. /// /// /// An operation code specifying the Berkley DB operation /// /// /// The percent of the operation that has been completed, specified as an /// integer value between 0 and 100. /// public delegate void DatabaseFeedbackDelegate( DatabaseFeedbackEvent opcode, int percent); /// /// An application-specified comparison function. /// /// The application supplied key. /// The current tree's key. /// /// An integer value less than, equal to, or greater than zero if the first /// key parameter is considered to be respectively less than, equal to, or /// greater than the second key parameter. /// public delegate int EntryComparisonDelegate( DatabaseEntry dbt1, DatabaseEntry dbt2); /// /// The application-specified feedback function called to report Berkeley DB /// operation progress. /// /// /// An operation code specifying the Berkley DB operation /// /// /// The percent of the operation that has been completed, specified as an /// integer value between 0 and 100. /// public delegate void EnvironmentFeedbackDelegate( EnvironmentFeedbackEvent opcode, int percent); /// /// The application-specified error reporting function. /// /// The prefix string /// The error message string public delegate void ErrorFeedbackDelegate( string errPrefix, string errMessage); /// /// The application's event notification function. /// /// /// An even code specifying the Berkeley DB event /// /// /// Additional information describing an event. By default, event_info is /// null; specific events may pass non-null values, in which case the event /// will also describe the information's structure. /// public delegate void EventNotifyDelegate( NotificationEvent eventcode, byte[] event_info); /// /// /// /// /// /// /// public delegate DatabaseEntry ForeignKeyNullifyDelegate( DatabaseEntry key, DatabaseEntry data, DatabaseEntry foreignkey); /// /// The application-specified hash function. /// /// /// A byte string representing a key in the database /// /// The hashed value of public delegate uint HashFunctionDelegate(byte[] data); /// /// The function used to transmit data using the replication application's /// communication infrastructure. /// /// /// The first of the two data elements to be transmitted by the send /// function. /// /// /// The second of the two data elements to be transmitted by the send /// function. /// /// /// If the type of message to be sent has an LSN associated with it, then /// this is the LSN of the record being sent. This LSN can be used to /// determine that certain records have been processed successfully by /// clients. /// /// /// /// A positive integer identifier that specifies the replication environment /// to which the message should be sent. /// /// /// The special identifier DB_EID_BROADCAST indicates that a message should /// be broadcast to every environment in the replication group. The /// application may use a true broadcast protocol or may send the message /// in sequence to each machine with which it is in communication. In both /// cases, the sending site should not be asked to process the message. /// /// /// The special identifier DB_EID_INVALID indicates an invalid environment /// ID. This may be used to initialize values that are subsequently checked /// for validity. /// /// /// XXX: TBD /// 0 on success and non-zero on failure public delegate int ReplicationTransportDelegate(DatabaseEntry control, DatabaseEntry rec, LSN lsn, int envid, uint flags); /// /// The function that creates the set of secondary keys corresponding to a /// given primary key and data pair. /// /// The primary key /// The primary data item /// The secondary key(s) public delegate DatabaseEntry SecondaryKeyGenDelegate( DatabaseEntry key, DatabaseEntry data); /// /// A function which returns a unique identifier pair for a thread of /// control in a Berkeley DB application. /// /// /// A DbThreadID object describing the current thread of control /// public delegate DbThreadID SetThreadIDDelegate(); /// /// A function which returns an identifier pair for a thread of control /// formatted for display. /// /// The thread of control to format /// The formatted identifier pair public delegate string SetThreadNameDelegate(DbThreadID info); /// /// A function which returns whether the thread of control, identified by /// , is still running. /// /// The thread of control to check /// /// If true, return only if the process is alive, and the /// portion of /// should be ignored. /// /// True if the tread is alive, false otherwise. public delegate bool ThreadIsAliveDelegate(DbThreadID info, bool procOnly); }