37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package artifacts
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/artifactmodel"
|
|
)
|
|
|
|
// Ref identifies a pipeline artifact and its local/remote coordinates.
|
|
type Ref struct {
|
|
Kind string
|
|
SourceID string
|
|
Category string
|
|
SessionID string
|
|
RelativePath string
|
|
AbsolutePath string
|
|
RemoteKey string
|
|
Checksum string
|
|
Contract *artifactmodel.ContractMetadata
|
|
ExternalProvenance *artifactmodel.ExternalProvenance
|
|
}
|
|
|
|
// 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)
|
|
AcquireSessionLockForContext(ctx context.Context, campaign, sessionID string) (*LockHandle, error)
|
|
ReleaseSessionLock(lock *LockHandle) error
|
|
}
|