baize

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Instance-related constants
	DefaultInstanceName = ""

	// Nil-data/Empty SHA-256 data
	EmptySha  = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
	EmptySize = int64(0)

	// Resource naming constants
	ResourceNameType   = "blobs"
	ResourceNameAction = "uploads"

	// Default buffer sizes
	DefaultReadCapacity = 1024 * 1024
)

Variables

View Source
var (
	ResourceReadFormatStr  string = fmt.Sprintf("[<instance-name>/]%s/<hash>/<size>[/filename]", ResourceNameType)
	ResourceWriteFormatStr string = fmt.Sprintf("[<instance-name>/]%s/<uuid>/%s/<hash>/<size>[/filename]", ResourceNameAction, ResourceNameType)
)

Functions

func ActionCache

func ActionCache(ctx context.Context, cache interfaces.Cache, instanceName string) (interfaces.Cache, error)

func CASCache

func CASCache(ctx context.Context, cache interfaces.Cache, instanceName string) (interfaces.Cache, error)

func ExecuteResponseWithResult

func ExecuteResponseWithResult(ar *repb.ActionResult, code codes.Code) *repb.ExecuteResponse

func GetDefaultReadResourceName

func GetDefaultReadResourceName(hash string, size int64) (string, error)

func GetDefaultWriteResourceName

func GetDefaultWriteResourceName(_uuid, hash string, size int64) (string, error)

func GetReadResourceName

func GetReadResourceName(instance, hash string, size int64, fname string) (string, error)

Return a valid read resource string based on individual components. Errors on invalid inputs.

func GetWriteResourceName

func GetWriteResourceName(instance, _uuid, hash string, size int64, fname string) (string, error)

Return a valid write resource string based on individual components. Errors on invalid inputs

func InProgressExecuteResponse

func InProgressExecuteResponse() *repb.ExecuteResponse

func IsValidDigest

func IsValidDigest(hash string, size int64) bool

func ReadProtoFromCAS

func ReadProtoFromCAS(ctx context.Context, cache interfaces.Cache, d *digest.ResourceName, out proto.Message) error

func ValidateActionResult

func ValidateActionResult(ctx context.Context, cache interfaces.Cache, r *repb.ActionResult) error

Types

type ExecutorServer

type ExecutorServer struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Configure) (*ExecutorServer, error)

func (*ExecutorServer) BatchReadBlobs

func (*ExecutorServer) BatchUpdateBlobs

func (*ExecutorServer) Execute

func (*ExecutorServer) FindMissingBlobs

func (*ExecutorServer) GetActionResult

func (*ExecutorServer) GetCapabilities

func (*ExecutorServer) GetTree

func (*ExecutorServer) Read

bytestream.RegisterByteStreamServer(s, &RemoteExecServer{})

func (*ExecutorServer) Run

func (s *ExecutorServer) Run() error

func (*ExecutorServer) UpdateActionResult

func (s *ExecutorServer) UpdateActionResult(ctx context.Context, in *repb.UpdateActionResultRequest) (*repb.ActionResult, error)

func (*ExecutorServer) WaitExecution

func (*ExecutorServer) Write

type Resource

type Resource struct {
	Instance string
	Digest   *repb.Digest
	UUID     uuid.UUID
}

func ParseReadResource

func ParseReadResource(name string) (*Resource, error)

Parses a name string from the Read API into a Resource for bazel artifacts. Valid read format: "[<instance>/]blobs/<hash>/<size>[/<filename>]" Scoot does not currently use/track the filename portion of resource names

func ParseResource

func ParseResource(instance, id, hash, sizeStr, name, format string) (*Resource, error)

Underlying Resource parser from separated URI components

func ParseWriteResource

func ParseWriteResource(name string) (*Resource, error)

Parses a name string from the Write API into a Resource for bazel artifacts. Valid read format: "[<instance>/]uploads/<uuid>/blobs/<hash>/<size>[/<filename>]" Scoot does not currently use/track the filename portion of resource names

func (*Resource) StoreName

func (r *Resource) StoreName() string

func (*Resource) String

func (r *Resource) String() string

type StateChangeFunc

type StateChangeFunc func(stage repb.ExecutionStage_Value, execResponse *repb.ExecuteResponse) error

func GetStateChangeFunc

func GetStateChangeFunc(stream StreamLike, taskID string, adInstanceDigest *digest.ResourceName) StateChangeFunc

type StreamLike

type StreamLike interface {
	Context() context.Context
	Send(*longrunning.Operation) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL