Files
narratio/internal/artifacts/store.go

28 lines
874 B
Go

package artifacts
import "os"
// Ref identifies a pipeline artifact and its local/remote coordinates.
type Ref struct {
Kind string
Category string
SessionID string
RelativePath string
AbsolutePath string
RemoteKey string
Checksum string
}
// Store is the local artifact/workdir abstraction used by orchestration code.
type Store interface {
SessionPathsFor(campaign, sessionID string) SessionPaths
EnsureLayoutFor(campaign, sessionID string) (SessionPaths, error)
CopyInputFor(campaign, sessionID, srcPath, destRelativePath string) (Ref, error)
Exists(path string) (bool, error)
ExistsRef(ref Ref) (bool, error)
WriteFileAtomic(path string, data []byte, perm os.FileMode) error
Checksum(path string) (string, error)
AcquireSessionLockFor(campaign, sessionID string) (*LockHandle, error)
ReleaseSessionLock(lock *LockHandle) error
}