Interface IArtifactStore
- Namespace
- OptunaSharp.Artifacts
- Assembly
- OptunaSharp.dll
A protocol defining the interface for an artifact backend.
Port of optuna/artifacts/_protocol.py: ArtifactStore (a Python Protocol → C#
interface).
The methods defined in this interface are not supposed to be directly called by library users. An artifact backend is responsible for managing the storage and retrieval of artifact data: opening, writing and removing artifacts.
public interface IArtifactStore
Methods
OpenReader(string)
Open the artifact identified by the artifactId as a readable
binary stream. If the artifact does not exist, an ArtifactNotFound
exception should be raised.
Stream OpenReader(string artifactId)
Parameters
artifactIdstringIdentifier of the artifact within the configured store.
Returns
- Stream
A readable stream owned by the caller; dispose it after reading.
Exceptions
- Exception
The configured store cannot retrieve the artifact.
Remove(string)
Remove the artifact identified by the artifactId. If the artifact
does not exist, an ArtifactNotFound exception may be raised.
void Remove(string artifactId)
Parameters
artifactIdstringIdentifier of the artifact within the configured store.
Exceptions
- Exception
The backend cannot delete the artifact.
Write(string, Stream)
Save the content to the backend.
void Write(string artifactId, Stream contentBody)
Parameters
artifactIdstringIdentifier of the artifact within the configured store.
contentBodyStreamReadable content stream; ownership stays with the caller.
Exceptions
- Exception
The backend or input stream fails during the upload.