Table of Contents

Class SqliteStepStorage

Namespace
Hi.SqliteUtils
Assembly
HiNc.dll

SQLite-based storage for milling step data. MillingStepLuggage data.

public class SqliteStepStorage : IDisposable
Inheritance
SqliteStepStorage
Implements
Inherited Members
Extension Methods

Constructors

SqliteStepStorage(string, ILogger)

Initializes a new instance of the SqliteStepStorage class.

public SqliteStepStorage(string databasePath = null, ILogger logger = null)

Parameters

databasePath string

The path to the SQLite database file. If null, uses the default per-user path (LocalApplicationData/HiNC/StepCache/step_cache.db) — callers hosting several instances under one account must pass a per-instance path.

logger ILogger

Optional logger instance.

Properties

DatabasePath

Gets the database file path.

public string DatabasePath { get; }

Property Value

string

Default

Gets or sets the default SQLite step storage instance.

public static SqliteStepStorage Default { get; set; }

Property Value

SqliteStepStorage

IsDefaultInit

Gets a value indicating whether the default storage has been initialized.

public static bool IsDefaultInit { get; }

Property Value

bool

Methods

ClearMillingStepLuggages()

Deletes all milling step luggages from the database.

public void ClearMillingStepLuggages()

CountMillingStepLuggages()

Gets the count of milling step luggages in the database.

public int CountMillingStepLuggages()

Returns

int

The count of records.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Releases the resources used by the storage.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Whether this method is being called from Dispose.

FindMillingStepLuggages(int, int)

Finds milling step luggages within the specified index range.

public List<MillingStepLuggage> FindMillingStepLuggages(int beginIndex, int endIndex)

Parameters

beginIndex int

The beginning index (inclusive).

endIndex int

The ending index (exclusive).

Returns

List<MillingStepLuggage>

A list of milling step luggages.

InsertMillingStepLuggages(IEnumerable<MillingStepLuggage>)

Inserts multiple milling step luggages into the database.

public void InsertMillingStepLuggages(IEnumerable<MillingStepLuggage> items)

Parameters

items IEnumerable<MillingStepLuggage>

The items to insert.

Reset()

Resets the storage by deleting and recreating the database file.

public void Reset()

Remarks

Delete-and-recreate instead of DELETE FROM: the per-run cache grows to many GB of step blobs and SQLite never returns freed pages to the file system (VACUUM would rewrite the whole file), so recreating the file is both the fastest wipe and the only practical space reclaim. Callers drain the luggage writer first (ResetStateAndClStripWaitAll) and the file is per-instance, so no other writer can be mid-batch. Falls back to the in-place table wipe when the file is still held open (e.g. a concurrent reader mid-query keeps the delete off on Windows).