TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class DatasetFileCache in Tinman.Terrain.Datasets

An file-based cache for IDataset s.

sealed class DatasetFileCache extends Disposable
  implements IFlushable

Remarks

Dataset file caches can be shared between multiple processes resp. machines, with the restriction that all shared dataset file caches must be opened read-only mode (see Open), which implies that the shared dataset file cache must have been warmed up in a pre-processing step.

The following table shows the binary layout of a dataset cache (multibyte values are encoded as LittleEndian).

Offset     | Type  | Count | Description
-----------+-------+-------+----------------------------------------------------
#0  ..  #7 |  int8 |     8 | Magic value that identifies a file used by a
           |       |       | dataset cache:
           |       |       | 0x89 0x48 0x47 0x43 0x0D 0x0A 0x1A 0x0A
-----------+-------+-------+----------------------------------------------------
#8  ..  #9 | int16 |     1 | Binary format version (currently 1).
-----------+-------+-------+----------------------------------------------------
#10 .. #17 | int64 |     1 | Maximum file size, in bytes.
-----------+-------+-------+----------------------------------------------------
#18 .. #39 |  int8 |    22 | Reserved (must be all zero).
-----------+-------+-------+----------------------------------------------------
#40 .. #47 | int64 |     1 | Block ID of root of primary block index.
-----------+-------+-------+----------------------------------------------------
#48 .. #55 |  int8 |     8 | Reserved, must be zero.
-----------+-------+-------+----------------------------------------------------
#56 .. #63 | int64 |     1 | Block ID of root of timestamp index "LastUsed".
-----------+-------+-------+----------------------------------------------------
#64 .. EOF |  int8 |     ? | Data area of dataset cache.
-----------+-------+-------+----------------------------------------------------
The data area of a dataset cache is managed by an embedded BlockStorage.

Public / Attributes

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Clear

Clears all cached dataset content from the cache.

[ThreadSafe]
public method Clear ()

Create

Creates a new dataset file cache.

[OwnerReturn]
public static method Create (Path filePath, int64 maximumFileSize = 0)
type DatasetFileCache
params filePath [not-null] Path to the cache file.
  maximumFileSize [>=0] The maximum file size, in bytes. If zero, the file size will be unlimited. Defaults to 0.
returns [not-null] The dataset file cache.

CreateOrOpen

Opens an existing dataset file cache or creates a new one if necessary.

[OwnerReturn]
public static method CreateOrOpen (Path filePath, int64 maximumFileSize = 0)
type DatasetFileCache
params filePath [not-null] Path to the cache file.
  maximumFileSize [>=0] The maximum file size, in bytes. If zero, the file size will be unlimited. Defaults to 0.
returns [not-null] The dataset file cache.

Remarks:

If the given file path points to a non-existent file, a new dataset file cache with the given properties will be created. If the file path refers to an existing dataset file cache, it will be opened iff its properties match maximumFileSize- otherwise a new dataset file cache is created and the existing one is overwritten.

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Flush

Flushes all cached data.

public method Flush ()
implements IFlushable.Flush

Remarks:

Performing a flush may result in I/O work. Depending on the semantics of the implementing class, this work may need to be wrapped in special Begin / End method calls. See the documentation of the implementing classes for details.

In case this object represents a read-only resource, calling the Flush method has no effect.

Open

Opens an existing dataset file cache.

[OwnerReturn]
public static method Open (Path filePath, bool readOnly = false)
type DatasetFileCache
params filePath [not-null] Path to the cache file.
  readOnly Open pyramid file cache in read-only mode? Use this for sharing warmed-up file caches between multiple processes or machines. Defaults to false.
returns [not-null] The dataset file cache.