DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Properties | Private Attributes | List of all members
Deveel.Data.Store.ObjectStore.LargeObject Class Reference
Inheritance diagram for Deveel.Data.Store.ObjectStore.LargeObject:
Deveel.Data.Store.ILargeObject

Public Member Functions

 LargeObject (ObjectStore store, long refId, long size, long currentSize, bool compressed, bool isComplete)
 
void Dispose ()
 
int Read (long offset, byte[] buffer, int length)
 Reads the content of the object, starting at a given offset, into the buffer given, for the number of bytes specified. More...
 
void Write (long offset, byte[] buffer, int length)
 Write the given binary content into the object, starting at the given offset for the number of bytes specified. More...
 
void Complete ()
 Marks the object as complete. More...
 
void Establish ()
 Establishes a reference of the object to the underlying store which contains it. More...
 
bool Release ()
 Removes a reference of the object from the underlying store which contains it. More...
 
void MarkComplete ()
 

Properties

ObjectId Id [get, private set]
 
long RawSize [get, private set]
 
long CurrentSize [get, private set]
 
bool IsCompressed [get, private set]
 
bool IsComplete [get, private set]
 
- Properties inherited from Deveel.Data.Store.ILargeObject
ObjectId Id [get]
 Gets the unique identifier of the object within the system. More...
 
long RawSize [get]
 Gets the raw byte size of the object. More...
 
bool IsCompressed [get]
 Gets a value indicating whether the object is compressed. More...
 
bool IsComplete [get]
 Gets a value indicating if the object is in its complete state, that means it cannot be written further, but it can only be read. More...
 

Private Attributes

readonly ObjectStore store
 

Detailed Description

Definition at line 217 of file ObjectStore.cs.

Constructor & Destructor Documentation

Deveel.Data.Store.ObjectStore.LargeObject.LargeObject ( ObjectStore  store,
long  refId,
long  size,
long  currentSize,
bool  compressed,
bool  isComplete 
)
inline

Definition at line 220 of file ObjectStore.cs.

Member Function Documentation

void Deveel.Data.Store.ObjectStore.LargeObject.Complete ( )
inline

Marks the object as complete.

After this method is invoked, the object is marked as complete and it cannot be written further.

Any call to Read before this method is called will throw an exception.

See also
IsComplete, Read, Write

Implements Deveel.Data.Store.ILargeObject.

Definition at line 254 of file ObjectStore.cs.

254  {
255  store.CompleteObject(this);
256  }
void CompleteObject(LargeObject obj)
Definition: ObjectStore.cs:271
void Deveel.Data.Store.ObjectStore.LargeObject.Dispose ( )
inline

Definition at line 229 of file ObjectStore.cs.

229  {
230  }
void Deveel.Data.Store.ObjectStore.LargeObject.Establish ( )
inline

Establishes a reference of the object to the underlying store which contains it.

A single object can be referenced multiple times within a store, and this prevents it to be removed from the store if it is still in use within the system.

See also
Release

Implements Deveel.Data.Store.ILargeObject.

Definition at line 258 of file ObjectStore.cs.

258  {
260  }
long Id
Gets the unique identifier of the object within the containing store.
Definition: ObjectId.cs:65
void EstablishReference(long id)
Definition: ObjectStore.cs:535
void Deveel.Data.Store.ObjectStore.LargeObject.MarkComplete ( )
inline

Definition at line 266 of file ObjectStore.cs.

266  {
267  IsComplete = true;
268  }
int Deveel.Data.Store.ObjectStore.LargeObject.Read ( long  offset,
byte[]  buffer,
int  length 
)
inline

Reads the content of the object, starting at a given offset, into the buffer given, for the number of bytes specified.

Parameters
offsetThe zero-based offset within the object at which to start reading the contents.
bufferThe array in which to write the contents read.
lengthThe desired number of bytes to read from the object contents.
Returns
Returns the actual number of bytes read from the object.

Implements Deveel.Data.Store.ILargeObject.

Definition at line 242 of file ObjectStore.cs.

242  {
243  return store.ReadObjectPart(Id.Id, offset, buffer, 0, length);
244  }
int ReadObjectPart(long id, long objOffset, byte[] buffer, int off, int length)
Definition: ObjectStore.cs:404
long Id
Gets the unique identifier of the object within the containing store.
Definition: ObjectId.cs:65
bool Deveel.Data.Store.ObjectStore.LargeObject.Release ( )
inline

Removes a reference of the object from the underlying store which contains it.

The act of removing a reference of an object from the containing store does not automatically destroys it: in fact, this happens only if all references established for the object have been released.

Returns
Returns true if the object was removed from the store at its release, or false if it was retained.
See also
Establish

Implements Deveel.Data.Store.ILargeObject.

Definition at line 262 of file ObjectStore.cs.

262  {
263  return store.ReleaseReference(Id.Id);
264  }
long Id
Gets the unique identifier of the object within the containing store.
Definition: ObjectId.cs:65
void Deveel.Data.Store.ObjectStore.LargeObject.Write ( long  offset,
byte[]  buffer,
int  length 
)
inline

Write the given binary content into the object, starting at the given offset for the number of bytes specified.

Parameters
offsetThe zero-based starting offset at which to start to write the specified contents.
bufferThe content to write to the underlying object.
lengthThe number of bytes from the given buffer to write into the object.

Implements Deveel.Data.Store.ILargeObject.

Definition at line 246 of file ObjectStore.cs.

246  {
247  if (IsComplete)
248  throw new IOException("The object is complete and cannot be written.");
249 
250  CurrentSize += length;
251  store.WriteObjectPart(Id.Id, offset, buffer, 0, length);
252  }
long Id
Gets the unique identifier of the object within the containing store.
Definition: ObjectId.cs:65
void WriteObjectPart(long id, long objOffset, byte[] buffer, int off, int length)
Definition: ObjectStore.cs:311

Member Data Documentation

readonly ObjectStore Deveel.Data.Store.ObjectStore.LargeObject.store
private

Definition at line 218 of file ObjectStore.cs.

Property Documentation

long Deveel.Data.Store.ObjectStore.LargeObject.CurrentSize
getprivate set

Definition at line 236 of file ObjectStore.cs.

ObjectId Deveel.Data.Store.ObjectStore.LargeObject.Id
getprivate set

Definition at line 232 of file ObjectStore.cs.

bool Deveel.Data.Store.ObjectStore.LargeObject.IsComplete
getprivate set

Definition at line 240 of file ObjectStore.cs.

bool Deveel.Data.Store.ObjectStore.LargeObject.IsCompressed
getprivate set

Definition at line 238 of file ObjectStore.cs.

long Deveel.Data.Store.ObjectStore.LargeObject.RawSize
getprivate set

Definition at line 234 of file ObjectStore.cs.


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