Interface ITilePersistentStore
Where the tile pipeline keeps downloaded tile bytes between sessions.
Implement it to put your own storage behind
TilePipelineDependencies.StoreFactory; the shipped
implementation is PackedTileStore.
public interface ITilePersistentStore : IDisposable
- Inherited Members
Remarks
The frame-path members (TryRead(ulong, out byte[], out int), Write(ulong, byte[], int, int), FlushDue(double, double)) must never throw: the pipeline calls them inside its tick, where a throw costs the rest of the frame. Report a failure through IoFailures and DroppedWrites instead, which is also how a read-only store says it refused a write. LansMap opens, owns and disposes the instance the factory returns.
Properties
CompactionsRun
Compactions that actually reclaimed space.
int CompactionsRun { get; }
Property Value
Disabled
True when the store holds nothing; every member then misses or drops.
bool Disabled { get; }
Property Value
DroppedWrites
Writes refused, including every write a read-only store declines.
int DroppedWrites { get; }
Property Value
IoFailures
Swallowed storage errors since this instance opened.
int IoFailures { get; }
Property Value
Settings
Cache configuration this store is enforcing.
TileCacheSettings Settings { get; }
Property Value
Stats
Occupancy and hit counters for this instance.
TileCacheStats Stats { get; }
Property Value
WritesRefusedAtFileBound
The subset of DroppedWrites a compaction would fix.
int WritesRefusedAtFileBound { get; }
Property Value
Methods
Clear()
Drops every stored tile.
void Clear()
CompactNow()
Reclaims dead space now.
bool CompactNow()
Returns
- bool
True when something was actually reclaimed.
Contains(ulong)
True when the key is stored, without reading its bytes.
bool Contains(ulong key)
Parameters
keyulongDisk cache key to test.
Returns
DrainPendingEviction(int)
Performs up to maxEvictions steps of an
eviction a cap change left outstanding, so shrinking the cache
never stalls a frame.
bool DrainPendingEviction(int maxEvictions = 256)
Parameters
maxEvictionsintEviction steps this call may perform.
Returns
- bool
True while eviction still has work left.
FlushDue(double, double)
Commits buffered writes if at least
intervalSeconds has passed since the last
commit. Frame path: never throws.
void FlushDue(double now, double intervalSeconds = 1)
Parameters
nowdoubleMonotonic seconds, the pipeline's own clock.
intervalSecondsdoubleMinimum gap between commits.
SetMaxDataBytes(long)
Changes the live-data cap.
void SetMaxDataBytes(long maxDataBytes)
Parameters
maxDataByteslongNew cap in bytes; must be positive.
TryRead(ulong, out byte[], out int)
Reads a tile blob back. Frame path: never throws.
bool TryRead(ulong key, out byte[] bytes, out int length)
Parameters
keyulongDisk cache key to look up.
bytesbyte[]Buffer holding the blob; may be longer than the payload, and may be reused by the next call.
lengthintPayload length in bytes.
Returns
- bool
True when the blob was found and read.
Write(ulong, byte[], int, int)
Stores a tile blob. Frame path: never throws.
void Write(ulong key, byte[] bytes, int length, int zoom)