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:
- path ( str)
Returns: str
read( path)
See Storage.read.
Parameters:
- path ( str)
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:
- path ( str)
Returns: bool
stat( path)
See Storage.stat.
Parameters:
- path ( str)
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:
- prefix ( str)
Returns: list[str]
remove( path)
See Storage.remove.
Parameters:
- path ( str)
Returns: None
remove_dir( path)
See Storage.remove_dir.
Parameters:
- path ( str)
Returns: None
flush()
See Storage.flush. No-op for local filesystem.
Returns: None
aread( path)
Async version of read.
Parameters:
- path ( str)
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:
- path ( str)
Returns: bool
astat( path)
Async version of stat.
Parameters:
- path ( str)
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:
- prefix ( str)
Returns: list[str]
aremove( path)
Async version of remove.
Parameters:
- path ( str)
Returns: None
aremove_dir( path)
Async version of remove_dir.
Parameters:
- path ( str)
Returns: None