Add artifact workdir layout and locking
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user