Add artifact workdir layout and locking

This commit is contained in:
2026-05-02 10:56:42 -05:00
parent 6caecb1baa
commit fb659e0d3d
8 changed files with 615 additions and 46 deletions

View File

@@ -1,19 +1,27 @@
package artifacts
import "context"
import "os"
// Ref identifies a pipeline artifact and optional remote location.
// Ref identifies a pipeline artifact and its local/remote coordinates.
type Ref struct {
Kind string
LocalPath string
RemoteKey string
Checksum string
Kind string
Category string
SessionID string
RelativePath string
AbsolutePath string
RemoteKey string
Checksum string
}
// Store is a placeholder artifact storage abstraction.
// Store is the local artifact/workdir abstraction used by orchestration code.
type Store interface {
WriteLocal(ctx context.Context, ref Ref, data []byte) error
ReadLocal(ctx context.Context, ref Ref) ([]byte, error)
ExistsLocal(ctx context.Context, ref Ref) (bool, error)
Upload(ctx context.Context, ref Ref) (string, error)
SessionPaths(sessionID string) SessionPaths
EnsureLayout(sessionID string) (SessionPaths, error)
CopyInput(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)
AcquireSessionLock(sessionID string) (*LockHandle, error)
ReleaseSessionLock(lock *LockHandle) error
}