2026-05-02 10:37:38 -05:00
|
|
|
package artifacts
|
|
|
|
|
|
2026-08-09 23:20:32 +00:00
|
|
|
import (
|
2026-08-10 18:14:09 +00:00
|
|
|
"context"
|
2026-08-09 23:20:32 +00:00
|
|
|
"os"
|
|
|
|
|
|
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/artifactmodel"
|
|
|
|
|
)
|
2026-05-02 10:37:38 -05:00
|
|
|
|
2026-05-02 10:56:42 -05:00
|
|
|
// Ref identifies a pipeline artifact and its local/remote coordinates.
|
2026-05-02 10:37:38 -05:00
|
|
|
type Ref struct {
|
2026-08-09 23:20:32 +00:00
|
|
|
Kind string
|
|
|
|
|
SourceID string
|
|
|
|
|
Category string
|
|
|
|
|
SessionID string
|
|
|
|
|
RelativePath string
|
|
|
|
|
AbsolutePath string
|
2026-08-10 19:16:18 +00:00
|
|
|
ArchivePath string
|
2026-08-09 23:20:32 +00:00
|
|
|
RemoteKey string
|
|
|
|
|
Checksum string
|
2026-09-04 15:57:54 +00:00
|
|
|
ProducerRunID string
|
2026-08-09 23:20:32 +00:00
|
|
|
Contract *artifactmodel.ContractMetadata
|
|
|
|
|
ExternalProvenance *artifactmodel.ExternalProvenance
|
2026-05-02 10:37:38 -05:00
|
|
|
}
|
|
|
|
|
|
2026-05-02 10:56:42 -05:00
|
|
|
// Store is the local artifact/workdir abstraction used by orchestration code.
|
2026-05-02 10:37:38 -05:00
|
|
|
type Store interface {
|
2026-05-17 20:57:27 +00:00
|
|
|
SessionPathsFor(campaign, sessionID string) SessionPaths
|
|
|
|
|
EnsureLayoutFor(campaign, sessionID string) (SessionPaths, error)
|
|
|
|
|
CopyInputFor(campaign, sessionID, srcPath, destRelativePath string) (Ref, error)
|
2026-05-02 10:56:42 -05:00
|
|
|
Exists(path string) (bool, error)
|
|
|
|
|
ExistsRef(ref Ref) (bool, error)
|
|
|
|
|
WriteFileAtomic(path string, data []byte, perm os.FileMode) error
|
|
|
|
|
Checksum(path string) (string, error)
|
2026-05-17 20:57:27 +00:00
|
|
|
AcquireSessionLockFor(campaign, sessionID string) (*LockHandle, error)
|
2026-08-10 18:14:09 +00:00
|
|
|
AcquireSessionLockForContext(ctx context.Context, campaign, sessionID string) (*LockHandle, error)
|
2026-05-02 10:56:42 -05:00
|
|
|
ReleaseSessionLock(lock *LockHandle) error
|
2026-05-02 10:37:38 -05:00
|
|
|
}
|