fCraft  0.636
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
Classes | Public Member Functions | Public Attributes | Properties | List of all members
fCraft.BlockDB Class Reference

Database of block changes. Each BlockDB object is associated with a world. Provides controls for storage/retention, and methods to look up data. More...

Public Member Functions

bool AutoToggleIfNeeded ()
 If EnabledState is set to Auto, calling this auto-enables / auto-disables BlockDB depending on world's BuildSecurity.MinRank and BlockDBAutoEnableRank config key.
 
void Clear ()
 Clears cache and deletes the .fbdb file.
 
BlockDBEntry[] Lookup (int max, BlockDBSearchType searchType,[NotNull] Func< BlockDBEntry, bool > selector)
 Searches the database for BlockDBEntries, based on given criteria.
 
void Traverse ([NotNull] IBlockDBQueryProcessor processor)
 Traverses the database, newest to oldest entries, processing each entry with the given IBlockDBQueryProcessor.
 
BlockDBEntry[] Lookup (int max, Vector3I coords)
 Returns list of all changes done to the map at the given coordinate, newest to oldest.
 
BlockDBEntry[] Lookup (int max)
 
BlockDBEntry[] Lookup (int max, TimeSpan span)
 
BlockDBEntry[] Lookup (int max,[NotNull] BoundingBox area)
 
BlockDBEntry[] Lookup (int max,[NotNull] BoundingBox area, TimeSpan span)
 
BlockDBEntry[] Lookup (int max,[NotNull] PlayerInfo info, bool exclude)
 
BlockDBEntry[] Lookup (int max,[NotNull] PlayerInfo info, bool exclude, TimeSpan span)
 
BlockDBEntry[] Lookup (int max,[NotNull] PlayerInfo[] infos, bool exclude)
 
BlockDBEntry[] Lookup (int max,[NotNull] PlayerInfo[] infos, bool exclude, TimeSpan span)
 
BlockDBEntry[] Lookup (int max,[NotNull] BoundingBox area,[NotNull] PlayerInfo info, bool exclude)
 
BlockDBEntry[] Lookup (int max,[NotNull] BoundingBox area,[NotNull] PlayerInfo info, bool exclude, TimeSpan span)
 
BlockDBEntry[] Lookup (int max,[NotNull] BoundingBox area,[NotNull] PlayerInfo[] infos, bool exclude)
 
BlockDBEntry[] Lookup (int max,[NotNull] BoundingBox area,[NotNull] PlayerInfo[] infos, bool exclude, TimeSpan span)
 
IDisposable GetWriteLock ()
 Acquires and returns an exclusive (write) lock for this BlockDB. Disposing the object returned by this method releases the lock.
 
IDisposable GetReadLock ()
 Acquires and returns a shared (read) lock for this BlockDB. Disposing the object returned by this method releases the lock.
 
XElement SaveSettings ()
 
XElement SaveSettings (string rootName)
 
void LoadSettings (XElement el)
 

Public Attributes

const string XmlRootName = "BlockDB"
 

Properties

World World [get, set]
 World associated with this BlockDB.
 
YesNoAuto EnabledState [get, set]
 Sets this BlockDB's enabled state to Yes (always on), No (aways off), or Auto (on or off depending on BlockDBAutoEnableRank config key and World's build permissions).
 
bool IsEnabled [get, set]
 Checks whether this BlockDB is enabled (either automatically or manually). Set EnabledState to enable/disable.
 
string FileName [get]
 Full path to the file where BlockDB data is stored.
 
bool IsPreloaded [get, set]
 
int Limit [get, set]
 
bool HasLimit [get]
 Whether this BlockDB instance has a limit on the number of entries.
 
TimeSpan TimeLimit [get, set]
 
bool HasTimeLimit [get]
 
static bool IsEnabledGlobally [get, set]
 Whether BlockDB was enabled at startup. Changing this setting currently requires a server restart.
 

Detailed Description

Database of block changes. Each BlockDB object is associated with a world. Provides controls for storage/retention, and methods to look up data.

Member Function Documentation

bool fCraft.BlockDB.AutoToggleIfNeeded ( )

If EnabledState is set to Auto, calling this auto-enables / auto-disables BlockDB depending on world's BuildSecurity.MinRank and BlockDBAutoEnableRank config key.

Returns
True if call resulted in IsEnabled being changed; otherwise false.
void fCraft.BlockDB.Clear ( )

Clears cache and deletes the .fbdb file.

IDisposable fCraft.BlockDB.GetReadLock ( )

Acquires and returns a shared (read) lock for this BlockDB. Disposing the object returned by this method releases the lock.

IDisposable fCraft.BlockDB.GetWriteLock ( )

Acquires and returns an exclusive (write) lock for this BlockDB. Disposing the object returned by this method releases the lock.

void fCraft.BlockDB.LoadSettings ( XElement  el)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
BlockDBSearchType  searchType,
[NotNull] Func< BlockDBEntry, bool >  selector 
)

Searches the database for BlockDBEntries, based on given criteria.

Parameters
maxMaximum number of entries to check.
searchTypeType of search (ReturnAll, ReturnOldest, or ReturnNewest). See BlockDBSearchType enum.
selectorFunction used to select BlockDBEntries to be returned.
Returns
Array of BlockDBEntry structs.
Exceptions
ArgumentOutOfRangeExceptionmax is less than 0.
ArgumentNullExceptionselector is null.
InvalidOperationExceptionBlockDB is disabled.
EndOfStreamExceptionThe end of FBDB file is reached prematurely (corrupted file, or outside interference).
DataMisalignedExceptionFBDB file is not aligned to 20 bytes (likely corrupted).
IOExceptionAn I/O error occurrs while trying to read FBDB file from disk.
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
Vector3I  coords 
)

Returns list of all changes done to the map at the given coordinate, newest to oldest.

Parameters
maxMaximum number of changes to return.
coordsCoordinate to search at.
Exceptions
ArgumentOutOfRangeExceptionGiven coordinates are outside the map.
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
TimeSpan  span 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] BoundingBox  area 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] BoundingBox  area,
TimeSpan  span 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] PlayerInfo  info,
bool  exclude 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] PlayerInfo  info,
bool  exclude,
TimeSpan  span 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] PlayerInfo[]  infos,
bool  exclude 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] PlayerInfo[]  infos,
bool  exclude,
TimeSpan  span 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] BoundingBox  area,
[NotNull] PlayerInfo  info,
bool  exclude 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] BoundingBox  area,
[NotNull] PlayerInfo  info,
bool  exclude,
TimeSpan  span 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] BoundingBox  area,
[NotNull] PlayerInfo[]  infos,
bool  exclude 
)
BlockDBEntry [] fCraft.BlockDB.Lookup ( int  max,
[NotNull] BoundingBox  area,
[NotNull] PlayerInfo[]  infos,
bool  exclude,
TimeSpan  span 
)
XElement fCraft.BlockDB.SaveSettings ( )
XElement fCraft.BlockDB.SaveSettings ( string  rootName)
void fCraft.BlockDB.Traverse ( [NotNull] IBlockDBQueryProcessor  processor)

Traverses the database, newest to oldest entries, processing each entry with the given IBlockDBQueryProcessor.

Parameters
processorProcessor to use for each BlockDBEntry.
Exceptions
ArgumentNullExceptionprocessor is null.
InvalidOperationExceptionBlockDB is disabled.
EndOfStreamExceptionThe end of FBDB file is reached prematurely (corrupted file, or outside interference).
DataMisalignedExceptionFBDB file is not aligned to 20 bytes (likely corrupted).
IOExceptionAn I/O error occurrs while trying to read FBDB file from disk.

Member Data Documentation

const string fCraft.BlockDB.XmlRootName = "BlockDB"

Property Documentation

YesNoAuto fCraft.BlockDB.EnabledState
getset

Sets this BlockDB's enabled state to Yes (always on), No (aways off), or Auto (on or off depending on BlockDBAutoEnableRank config key and World's build permissions).

string fCraft.BlockDB.FileName
get

Full path to the file where BlockDB data is stored.

bool fCraft.BlockDB.HasLimit
get

Whether this BlockDB instance has a limit on the number of entries.

bool fCraft.BlockDB.HasTimeLimit
get
bool fCraft.BlockDB.IsEnabled
getset

Checks whether this BlockDB is enabled (either automatically or manually). Set EnabledState to enable/disable.

bool fCraft.BlockDB.IsEnabledGlobally
staticgetset

Whether BlockDB was enabled at startup. Changing this setting currently requires a server restart.

bool fCraft.BlockDB.IsPreloaded
getset
int fCraft.BlockDB.Limit
getset
TimeSpan fCraft.BlockDB.TimeLimit
getset
World fCraft.BlockDB.World
getset

World associated with this BlockDB.


The documentation for this class was generated from the following file: