LocalStorage - Tinker Documentation

tinker_cookbook.stores.LocalStorage

class tinker_cookbook.stores.LocalStorage()

File-based storage rooted at a local directory.

Implements both Storage (sync) and AsyncStorage (via to_thread). Pickle-serializable (stores only a Path).

property root

The resolved local directory root.

Returns: Path

url( path)

Return a file:/// URI for the given path.

Parameters:

Returns: str

read( path)

See Storage.read.

Parameters:

Returns: bytes

write( path, data)

See Storage.write.

Parameters:

Returns: None

append( path, data)

See Storage.append.

Parameters:

Returns: None

exists( path)

See Storage.exists.

Parameters:

Returns: bool

stat( path)

See Storage.stat.

Parameters:

Returns: StorageStat | None

read_range( path, offset, length)

See Storage.read_range.

Parameters:

Returns: bytes

list_dir( prefix)

See Storage.list_dir. Returns sorted names.

Parameters:

Returns: list[str]

remove( path)

See Storage.remove.

Parameters:

Returns: None

remove_dir( path)

See Storage.remove_dir.

Parameters:

Returns: None

flush()

See Storage.flush. No-op for local filesystem.

Returns: None

aread( path)

Async version of read.

Parameters:

Returns: bytes

awrite( path, data)

Async version of write.

Parameters:

Returns: None

aappend( path, data)

Async version of append.

Parameters:

Returns: None

aexists( path)

Async version of exists.

Parameters:

Returns: bool

astat( path)

Async version of stat.

Parameters:

Returns: StorageStat | None

aread_range( path, offset, length)

Async version of read_range.

Parameters:

Returns: bytes

alist_dir( prefix)

Async version of list_dir.

Parameters:

Returns: list[str]

aremove( path)

Async version of remove.

Parameters:

Returns: None

aremove_dir( path)

Async version of remove_dir.

Parameters:

Returns: None

Referenced by