Table of Contents

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

int

Disabled

True when the store holds nothing; every member then misses or drops.

bool Disabled { get; }

Property Value

bool

DroppedWrites

Writes refused, including every write a read-only store declines.

int DroppedWrites { get; }

Property Value

int

IoFailures

Swallowed storage errors since this instance opened.

int IoFailures { get; }

Property Value

int

Settings

Cache configuration this store is enforcing.

TileCacheSettings Settings { get; }

Property Value

TileCacheSettings

Stats

Occupancy and hit counters for this instance.

TileCacheStats Stats { get; }

Property Value

TileCacheStats

WritesRefusedAtFileBound

The subset of DroppedWrites a compaction would fix.

int WritesRefusedAtFileBound { get; }

Property Value

int

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

key ulong

Disk cache key to test.

Returns

bool

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

maxEvictions int

Eviction 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

now double

Monotonic seconds, the pipeline's own clock.

intervalSeconds double

Minimum gap between commits.

SetMaxDataBytes(long)

Changes the live-data cap.

void SetMaxDataBytes(long maxDataBytes)

Parameters

maxDataBytes long

New 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

key ulong

Disk cache key to look up.

bytes byte[]

Buffer holding the blob; may be longer than the payload, and may be reused by the next call.

length int

Payload 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)

Parameters

key ulong

Disk cache key from the source's DiskCacheKey.

bytes byte[]

Source buffer; only the first length bytes belong to the tile.

length int

Payload length in bytes.

zoom int

Tile zoom, which decides the retention tier.