Documentation
¶
Index ¶
- Constants
- Variables
- type CacheClient
- type CacheCommitReq
- type CacheCommitResp
- type CacheCreateReq
- type CacheCreateResp
- type CachePeekReq
- type CachePeekResp
- type CacheRegistryResp
- type CacheRetrieveReq
- type CacheRetrieveResp
- type Client
- func (c Client) CacheCommit(ctx context.Context, registry string, commit CacheCommitReq) (CacheCommitResp, error)
- func (c Client) CacheCreate(ctx context.Context, registry string, create CacheCreateReq) (CacheCreateResp, error)
- func (c Client) CachePeekExists(ctx context.Context, registry string, create CachePeekReq) (CachePeekResp, bool, error)
- func (c Client) CacheRegistry(ctx context.Context, registry string) (CacheRegistryResp, error)
- func (c Client) CacheRetrieve(ctx context.Context, registry string, retrieve CacheRetrieveReq) (CacheRetrieveResp, bool, error)
- func (c Client) Do(req *http.Request) (*http.Response, error)
- type MessageGetter
Constants ¶
View Source
const ( CacheRegistryNotFound = "Cache registry not found" CacheEntryNotFound = "Cache entry not found" )
Variables ¶
View Source
var (
ErrCacheEntryNotFound = errors.New("cache entry not found")
)
Functions ¶
This section is empty.
Types ¶
type CacheClient ¶
type CacheClient interface {
// CacheRegistry retrieves information about a cache registry.
// Returns the registry configuration or an error if not found.
CacheRegistry(ctx context.Context, registry string) (CacheRegistryResp, error)
// CachePeekExists checks if a cache entry exists for the given key.
// Returns the cache metadata, a boolean indicating existence (true if found), and any error.
// When the cache entry is not found, returns (resp, false, nil) with resp.Message set.
CachePeekExists(ctx context.Context, registry string, req CachePeekReq) (CachePeekResp, bool, error)
// CacheCreate creates a new cache entry and returns upload information.
// Returns upload instructions including the upload ID and storage location.
CacheCreate(ctx context.Context, registry string, req CacheCreateReq) (CacheCreateResp, error)
// CacheCommit marks a cache entry as committed after successful upload.
// The upload ID from CacheCreate must be provided.
CacheCommit(ctx context.Context, registry string, req CacheCommitReq) (CacheCommitResp, error)
// CacheRetrieve retrieves download information for a cache entry.
// Returns the cache metadata, a boolean indicating if found (true if exists), and any error.
// When the cache entry is not found, returns (resp, false, nil) with resp.Message set.
// The response may indicate a fallback key was used via resp.Fallback.
CacheRetrieve(ctx context.Context, registry string, req CacheRetrieveReq) (CacheRetrieveResp, bool, error)
}
CacheClient defines the interface for cache API operations. This interface is implemented by Client and can be mocked for testing.
type CacheCommitReq ¶
type CacheCommitReq struct {
UploadID string `json:"upload_id"`
}
type CacheCommitResp ¶
type CacheCommitResp struct {
Message string `json:"message"`
}
type CacheCreateReq ¶
type CacheCreateReq struct {
Store string `json:"store"` // The store used for the cache entry
Key string `json:"key"`
FallbackKeys []string `json:"fallback_keys"`
Compression string `json:"compression"`
FileSize int `json:"file_size"`
Digest string `json:"digest"`
Paths []string `json:"paths"`
Platform string `json:"platform"`
Pipeline string `json:"pipeline"`
Branch string `json:"branch"`
Organization string `json:"owner"`
}
type CacheCreateResp ¶
type CachePeekReq ¶
type CachePeekResp ¶
type CachePeekResp struct {
Store string `json:"store"` // The store used for the cache entry
Digest string `json:"digest"`
ExpiresAt time.Time `json:"expires_at"`
Compression string `json:"compression"`
Message string `json:"message"`
FileSize int `json:"file_size"`
Paths []string `json:"paths"`
Pipeline string `json:"pipeline"`
Branch string `json:"branch"`
Owner string `json:"owner"`
Platform string `json:"platform"`
Key string `json:"key"`
FallbackKeys []string `json:"fallback_keys"`
CreatedAt time.Time `json:"created_at"`
AgentID string `json:"agent_id"`
JobID string `json:"job_id"`
BuildID string `json:"build_id"`
}
func (CachePeekResp) GetMessage ¶
func (r CachePeekResp) GetMessage() string
GetMessage returns the message for CachePeekResp
type CacheRegistryResp ¶
type CacheRetrieveReq ¶
type CacheRetrieveResp ¶
type CacheRetrieveResp struct {
Store string `json:"store"` // The store used for the cache entry
Key string `json:"key"` // The key of the cache entry, we MUST use this in rest of the restore process to cater for fallbacks
Fallback bool `json:"fallback"` // Indicates if this is a fallback cache entry
StoreObjectName string `json:"store_object_name"` // the identifier used to read the key in blob storage
ExpiresAt time.Time `json:"expires_at"`
CompressionType string `json:"compression_type"`
Multipart bool `json:"multipart"`
DownloadInstructions []string `json:"download_instructions"`
Message string `json:"message"`
}
func (CacheRetrieveResp) GetMessage ¶
func (r CacheRetrieveResp) GetMessage() string
GetMessage returns the message for CacheRetrieveResp
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) CacheCommit ¶
func (c Client) CacheCommit(ctx context.Context, registry string, commit CacheCommitReq) (CacheCommitResp, error)
func (Client) CacheCreate ¶
func (c Client) CacheCreate(ctx context.Context, registry string, create CacheCreateReq) (CacheCreateResp, error)
func (Client) CachePeekExists ¶
func (c Client) CachePeekExists(ctx context.Context, registry string, create CachePeekReq) (CachePeekResp, bool, error)
func (Client) CacheRegistry ¶
func (Client) CacheRetrieve ¶
func (c Client) CacheRetrieve(ctx context.Context, registry string, retrieve CacheRetrieveReq) (CacheRetrieveResp, bool, error)
type MessageGetter ¶
type MessageGetter interface {
GetMessage() string
}
MessageGetter interface for types that have a Message field
Click to show internal directories.
Click to hide internal directories.