DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Properties | List of all members
Deveel.Data.Store.IStore Interface Reference

A store is a resource where areas can be allocated and freed to store information (a memory allocator). More...

Inheritance diagram for Deveel.Data.Store.IStore:
Deveel.Data.Store.InMemoryStore Deveel.Data.Store.StoreBase Deveel.Data.Store.SingleFileStore

Public Member Functions

IArea CreateArea (long size)
 Allocates a block of memory in the store of the specified size and returns an IArea object that can be used to initialize the contents of the area. More...
 
void DeleteArea (long id)
 Deletes an area that was previously allocated by the CreateArea method by the area id. More...
 
IArea GetArea (long id, bool readOnly)
 Returns an object that allows for the contents of an area (represented by the id parameter) to be Read. More...
 
void Lock ()
 This method is called before the start of a sequence of Write commands between consistant states of some data structure represented by the store. More...
 
void Unlock ()
 This method is called after the end of a sequence of Write commands between consistant states of some data structure represented by the store. More...
 
IEnumerable< long > GetAllAreas ()
 Returns a complete list of pointers to all areas in the Store as long objects sorted from lowest pointer to highest. More...
 

Properties

bool ClosedClean [get]
 Indicates if the store was closed cleanly last time was accessed. More...
 

Detailed Description

A store is a resource where areas can be allocated and freed to store information (a memory allocator).

A store can be backed by a file system or main memory, or any type of information storage mechanism that allows the creation, modification and fast lookup of blocks of information.

Some characteristics of implementations of Store may be separately specified. For example, a file based store that is intended to persistently store objects may have robustness as a primary requirement. A main memory based store, or another type of volatile storage system, may not need to be sensitive to system crashes or data consistancy requirements across multiple sessions.

Some important assumptions for implementations; The data must not be changed in any way outside of the methods provided by the methods in the class. For persistant implementations, the information must remain the same over invocations, however its often not possible to guarantee this. At least, the store should be able to recover to the last check point.

This interface is the principle class to implement when porting the database to different types of storage devices.

Note that we use 'long' identifiers to reference areas in the store however only the first 60 bits of an identifer will be used unless we are referencing system (the static area is -1) or implementation specific areas.

Definition at line 56 of file IStore.cs.

Member Function Documentation

IArea Deveel.Data.Store.IStore.CreateArea ( long  size)

Allocates a block of memory in the store of the specified size and returns an IArea object that can be used to initialize the contents of the area.

Parameters
sizeThe amount of memory to allocate.

Note that an area in the store is undefined until the IArea.Flush method is called in IArea.

Returns
Returns an IArea object that allows the area to be setup.
Exceptions
System.IO.IOExceptionIf not enough space available to create the area or the store is Read-only.

Implemented in Deveel.Data.Store.StoreBase, and Deveel.Data.Store.InMemoryStore.

void Deveel.Data.Store.IStore.DeleteArea ( long  id)

Deletes an area that was previously allocated by the CreateArea method by the area id.

Parameters
idThe identifier of the area to delete.

Once an area is deleted the resources may be reclaimed. The behaviour of this method is undefined if the id doesn't represent a valid area.

Exceptions
IOExceptionIf the id is invalid or the area can not otherwise by deleted.

Implemented in Deveel.Data.Store.StoreBase, and Deveel.Data.Store.InMemoryStore.

IEnumerable<long> Deveel.Data.Store.IStore.GetAllAreas ( )

Returns a complete list of pointers to all areas in the Store as long objects sorted from lowest pointer to highest.

This should be used for diagnostics only because it may be difficult for this to be generated with some implementations. It is useful in a repair tool to determine if a pointer is valid or not.

Returns
Returns an implementation of IList that contains all the pointers (as long) to the areas from the lowest to the highest.

Implemented in Deveel.Data.Store.StoreBase, and Deveel.Data.Store.InMemoryStore.

IArea Deveel.Data.Store.IStore.GetArea ( long  id,
bool  readOnly 
)

Returns an object that allows for the contents of an area (represented by the id parameter) to be Read.

Parameters
idThe identifier of the area to Read, or -1 for a 64 byte fixed area in the store.
readOnlyIndicates if the returned area must be read-only.

The behaviour of this method is undefined if the id doesn't represent a valid area.

When id is -1 then a fixed area (64 bytes in size) in the store is returned. The fixed area can be used to store important static information.

Returns
Returns an IArea object that allows access to the part of the store.
Exceptions
IOExceptionIf the id is invalid or the area can not otherwise be accessed.

Implemented in Deveel.Data.Store.StoreBase, and Deveel.Data.Store.InMemoryStore.

void Deveel.Data.Store.IStore.Lock ( )

This method is called before the start of a sequence of Write commands between consistant states of some data structure represented by the store.

This Lock mechanism is intended to inform the store when it is not safe to checkpoint the data in a log, ensuring that no partial updates are committed to a transaction log and the data can be restored in a consistant manner.

If the store does not implement a check point log or is otherwise not interested in consistant states of the data, then it is not necessary for this method to do anything.

This method prevents a check point from happening during some sequence of operations. This method should not Lock unless a check point is in progress. This method does not prevent concurrent writes to the store.

See also
Unlock

Implemented in Deveel.Data.Store.StoreBase, Deveel.Data.Store.InMemoryStore, and Deveel.Data.Store.SingleFileStore.

void Deveel.Data.Store.IStore.Unlock ( )

This method is called after the end of a sequence of Write commands between consistant states of some data structure represented by the store.

See the Lock method for a further description of the operation of this locking mechanism.

See also
Lock

Implemented in Deveel.Data.Store.StoreBase, Deveel.Data.Store.InMemoryStore, and Deveel.Data.Store.SingleFileStore.

Property Documentation

bool Deveel.Data.Store.IStore.ClosedClean
get

Indicates if the store was closed cleanly last time was accessed.

Returns true if the store was closed cleanly last time it was accessed or false otherwise.

This is important information that may need to be considered when reading information from the store. This is typically used to issue a scan on the data in the store when it is not closed cleanly.

Definition at line 187 of file IStore.cs.


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