Documentation ¶
Index ¶
- Constants
- type CacheKey
- type Config
- type ExportRecord
- type GetCacheMountConfigRequest
- type GetCacheMountConfigResponse
- type GetCacheMountUploadURLRequest
- type GetCacheMountUploadURLResponse
- type GetConfigRequest
- type GetLayerDownloadURLRequest
- type GetLayerDownloadURLResponse
- type GetLayerUploadURLRequest
- type GetLayerUploadURLResponse
- type Link
- type Manager
- type ManagerConfig
- type RecordLayers
- type Result
- type Service
- type SyncedCacheMountConfig
- type UpdateCacheLayersRequest
- type UpdateCacheRecordsRequest
- type UpdateCacheRecordsResponse
Constants ¶
View Source
const (
LocalCacheID = "local"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type ExportRecord ¶
type ExportRecord struct { Digest digest.Digest // record digest CacheRefID string // worker cache id }
type GetCacheMountConfigRequest ¶ added in v0.5.2
type GetCacheMountConfigRequest struct{}
type GetCacheMountConfigResponse ¶ added in v0.5.2
type GetCacheMountConfigResponse struct {
SyncedCacheMounts []SyncedCacheMountConfig
}
type GetCacheMountUploadURLRequest ¶ added in v0.5.2
type GetCacheMountUploadURLResponse ¶ added in v0.5.2
type GetConfigRequest ¶
type GetConfigRequest struct {
EngineID string
}
func (GetConfigRequest) String ¶
func (r GetConfigRequest) String() string
type GetLayerDownloadURLRequest ¶ added in v0.5.2
type GetLayerDownloadURLRequest struct {
Digest digest.Digest
}
type GetLayerDownloadURLResponse ¶ added in v0.5.2
type GetLayerDownloadURLResponse struct {
URL string
}
type GetLayerUploadURLRequest ¶ added in v0.5.2
type GetLayerUploadURLRequest struct {
Digest digest.Digest
}
type GetLayerUploadURLResponse ¶ added in v0.5.2
type Manager ¶
type Manager interface { solver.CacheManager StartCacheMountSynchronization(context.Context) error ReleaseUnreferenced(context.Context) error Close(context.Context) error }
func NewManager ¶
func NewManager(ctx context.Context, managerConfig ManagerConfig) (Manager, error)
type ManagerConfig ¶
type ManagerConfig struct { KeyStore solver.CacheKeyStorage ResultStore solver.CacheResultStorage Worker worker.Worker MountManager *mounts.MountManager ServiceURL string Token string EngineID string }
type RecordLayers ¶
type RecordLayers struct { RecordDigest digest.Digest Layers []ocispecs.Descriptor }
type Service ¶
type Service interface { // GetConfig returns configuration needed for the engine to push layer blobs GetConfig(context.Context, GetConfigRequest) (*Config, error) // UpdateCacheRecords informs the cache service of the current state of the cache metadata. // It returns a list of cache refs that should be prepared for export and pushed. UpdateCacheRecords(context.Context, UpdateCacheRecordsRequest) (*UpdateCacheRecordsResponse, error) // UpdateCacheLayers tells the cache service that layers for the given records have been // uploaded with the given digests. UpdateCacheLayers(context.Context, UpdateCacheLayersRequest) error // ImportCache returns a cache config that the engine can turn into cache manager. ImportCache(context.Context) (*remotecache.CacheConfig, error) // GetLayerDownloadURL returns a URL that the engine can use to download the layer blob. The URL // is only valid for a limited time so this API should only be called right as the layer is needed. GetLayerDownloadURL(context.Context, GetLayerDownloadURLRequest) (*GetLayerDownloadURLResponse, error) // GetLayerUploadURL returns a URL that the engine can use to upload the layer blob. The URL is only // valid for a limited time so this API should only be called right as the layer is to be uploaded. GetLayerUploadURL(context.Context, GetLayerUploadURLRequest) (*GetLayerUploadURLResponse, error) // GetCacheMountConfig returns a list of cache mounts that the engine should sync locally. It contains // metadata like digest+size plus a time-limited URL that the engine can use to download the cache mounts. GetCacheMountConfig(context.Context, GetCacheMountConfigRequest) (*GetCacheMountConfigResponse, error) // GetCacheMountUploadURL returns a URL that the engine can use to upload the cache mount blob. The URL is only // valid for a limited time so this API should only be called right as the cache mount is to be uploaded. GetCacheMountUploadURL(context.Context, GetCacheMountUploadURLRequest) (*GetCacheMountUploadURLResponse, error) }
The process on export is as follows:
- Engine gathers metadata for current state of its local cache and sends it to the cache service via UpdateCacheRecords
- The cache service responds with a list of cache refs that should be exported, if any
- The engine compresses those them into layers, pushes them and then updates the cache service on what the digests of the layers ended up being via UpdateCacheLayers
The process on import is as follows:
- The engine asks for a cache config from the cache service via ImportCache. This cache config is the same format used by buildkit to create cache managers from remote caches.
- The cache service responds with that cache config
- The engine creates a cache manager from the cache config and plugs it into the combined cache manager with the actual local cache
For cache mounts, the process is:
- At engine startup, GetCacheMountConfig is called and any cache mounts returned are synced locally to the corresponding cache mount. This happens before any clients can connect to ensure consistency. The cache mount is a compressed tarball of the cache mount contents.
- At engine shutdown, those cache mounts are synced back to the cache service. GetCacheMountUploadURL is called to get a URL to upload to, which may or may not be the same as the original download URL.
type SyncedCacheMountConfig ¶ added in v0.5.2
type UpdateCacheLayersRequest ¶
type UpdateCacheLayersRequest struct {
UpdatedRecords []RecordLayers
}
func (UpdateCacheLayersRequest) String ¶
func (r UpdateCacheLayersRequest) String() string
type UpdateCacheRecordsRequest ¶
func (UpdateCacheRecordsRequest) String ¶
func (r UpdateCacheRecordsRequest) String() string
type UpdateCacheRecordsResponse ¶
type UpdateCacheRecordsResponse struct { // cache records that the engine should prepare layers for and push ExportRecords []ExportRecord }
func (UpdateCacheRecordsResponse) String ¶
func (r UpdateCacheRecordsResponse) String() string
Click to show internal directories.
Click to hide internal directories.