TracStorageApi¶
- class tracdap.api.TracStorageApi¶
Low-level API for reading and writing content directly in TRAC-managed storage.
Unlike TracDataApi, this API works directly with files and directories in a named storage location (identified by a storage key and path), without creating or updating any metadata in the TRAC metadata store. It is intended for use cases that need direct access to the underlying storage technology, rather than TRAC’s managed data and file objects.
- exists(request)¶
Check whether a file or directory exists at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- ls(request)¶
List the contents of a directory at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- mkdir(request)¶
Create a directory at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- readFile(request)¶
Read a file as a stream of content chunks.
This is a server-streaming method, intended for files that may be too large to return in a single message. Use readSmallFile() for a simpler, unary alternative.
- Parameters:
request (StorageReadRequest)
- Return type:
- readSmallFile(request)¶
Read a file and return its content in a single message.
This is a unary method; errors may occur if the file is too large to fit in a single message frame. Use readFile() to stream larger files instead.
- Parameters:
request (StorageReadRequest)
- Return type:
- rm(request)¶
Remove a file at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- rmdir(request)¶
Remove a directory at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- size(request)¶
Get the size in bytes of a file at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- stat(request)¶
Get metadata (FileStat) for a file or directory at the given storage path.
- Parameters:
request (StorageRequest)
- Return type:
- writeFile(request)¶
Write a file from a stream of content chunks.
This is a client-streaming method, intended for files that may be too large to send in a single message. Use writeSmallFile() for a simpler, unary alternative.
- Parameters:
request (StorageWriteRequest)
- Return type:
- writeSmallFile(request)¶
Write a file in a single message.
This is a unary method; errors may occur if the content is too large to fit in a single message frame. Use writeFile() to stream larger content instead.
- Parameters:
request (StorageWriteRequest)
- Return type: