Documentation
¶
Overview ¶
Package objectstoreplugin implements the object-store plugin API on GCS or S3 object storage, using the plugin's own credentials.
Snapshot files are stored as zstd-compressed objects named <file>.zstd under the snapshot URI, except the manifest, which is stored as is. This is the layout atelet has always written, so snapshots taken before the plugin existed stay readable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetPlugin ¶
type AssetPlugin struct {
objectstorev1.UnimplementedAssetProviderServer
// contains filtered or unexported fields
}
AssetPlugin serves AssetProvider on an object storage client. It reads URIs of its backend's scheme (gs:// on GCS, s3:// on S3) as <bucket>/<object>, and returns InvalidArgument for any other scheme without reading anything: a gs:// bucket name read on S3 names someone else's bucket, or none. atelet then reads a gs:// asset anonymously.
It downloads each asset into stagingDir, which must be private to the plugin, and copies it to the caller's file only once its size and sha256 check out (see assetfetch.Stager). The caller can therefore never read bytes it did not pin, such as a snapshot's.
func NewAssetPlugin ¶
func NewAssetPlugin(client objectstorage.ObjectStorage, scheme, root, stagingDir string, stagingCapacity int64) (*AssetPlugin, error)
NewAssetPlugin returns an AssetPlugin that serves URIs of scheme ("gs" or "s3", client's backend) from client, writes caller files only below root and stages downloads in stagingDir, which must not be below root, holding at most stagingCapacity bytes there at once.
func (*AssetPlugin) FetchAsset ¶
func (p *AssetPlugin) FetchAsset(ctx context.Context, req *objectstorev1.FetchAssetRequest) (*objectstorev1.FetchAssetResponse, error)
FetchAsset downloads the object at asset_uri into the staging directory and, if it is at most max_bytes long and hashes to sha256, copies it into the existing file at write_path (see assetfetch.Stager.Fetch).
type ControlPlugin ¶
type ControlPlugin struct {
objectstorev1.UnimplementedControlProviderServer
// contains filtered or unexported fields
}
ControlPlugin serves ControlProvider on an object store.
func NewControlPlugin ¶
func NewControlPlugin(store objectstore.Store) *ControlPlugin
NewControlPlugin returns a ControlPlugin backed by store.
func (*ControlPlugin) CleanupSnapshot ¶
func (p *ControlPlugin) CleanupSnapshot(ctx context.Context, req *objectstorev1.CleanupSnapshotRequest) (*objectstorev1.CleanupSnapshotResponse, error)
CleanupSnapshot deletes every object under the given prefix.
func (*ControlPlugin) CopySnapshot ¶
func (p *ControlPlugin) CopySnapshot(ctx context.Context, req *objectstorev1.CopySnapshotRequest) (*objectstorev1.CopySnapshotResponse, error)
CopySnapshot copies every object of src_uri to dst_uri.
type Credentials ¶
type Credentials interface {
// Client returns the client for the actor actorJWT names.
Client(ctx context.Context, actorJWT string, force bool) (objectstorage.ObjectStorage, error)
}
Credentials supplies the storage client a snapshot transfer runs with. The node plugin asks once per transfer with the actor JWT the request carries, and again with force set after storage refused a request, which means the credential behind the client no longer covers the actor. The GCS source is exchangeclient, which trades the JWT for a token scoped to the actor. The S3 source is Ambient, which ignores the JWT.
func Ambient ¶
func Ambient(client objectstorage.ObjectStorage) Credentials
Ambient returns Credentials that hand out client for every transfer, the pod's own credential, whatever JWT the request carries.
type NodeOption ¶
type NodeOption func(*NodePlugin)
NodeOption configures a NodePlugin.
func WithCredentials ¶
func WithCredentials(creds Credentials) NodeOption
WithCredentials makes transfers run with the client creds supplies for the actor JWT each request carries, instead of the ambient client.
type NodePlugin ¶
type NodePlugin struct {
objectstorev1.UnimplementedNodeProviderServer
// contains filtered or unexported fields
}
NodePlugin serves NodeProvider on an object storage client.
func NewNodePlugin ¶
func NewNodePlugin(client objectstorage.ObjectStorage, root string, uploadMemory int64, opts ...NodeOption) (*NodePlugin, error)
NewNodePlugin returns a NodePlugin that reads and writes local files only below root. All upload requests share uploadMemory bytes of reservations for compression and backend buffers. client is the pod's own storage client, GCS or S3 as the environment selected. It sizes that budget and serves every transfer unless WithCredentials supplies a per-actor one.
func (*NodePlugin) FetchSnapshot ¶
func (p *NodePlugin) FetchSnapshot(ctx context.Context, req *objectstorev1.FetchSnapshotRequest) (*objectstorev1.FetchSnapshotResponse, error)
FetchSnapshot downloads the requested snapshot files into write_path.
func (*NodePlugin) UploadSnapshot ¶
func (p *NodePlugin) UploadSnapshot(ctx context.Context, req *objectstorev1.UploadSnapshotRequest) (*objectstorev1.UploadSnapshotResponse, error)
UploadSnapshot uploads the requested files from local_path into the snapshot.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package actorlookup fetches the actor an exchange request names from ate-api-server.
|
Package actorlookup fetches the actor an exchange request names from ate-api-server. |
|
Package actorscope derives the object-storage prefixes an actor's transfers may touch from the actor record, with the access each needs.
|
Package actorscope derives the object-storage prefixes an actor's transfers may touch from the actor record, with the access each needs. |
|
Package credential holds the credential type the exchange hands out and its issuers produce.
|
Package credential holds the credential type the exchange hands out and its issuers produce. |
|
Package exchange serves this plugin's credential exchange.
|
Package exchange serves this plugin's credential exchange. |
|
Package exchangeclient is the GCS node plugin's side of the credential exchange.
|
Package exchangeclient is the GCS node plugin's side of the credential exchange. |
|
Package gcsboundary turns actor grants into the Credential Access Boundary rules a downscoped GCS token carries.
|
Package gcsboundary turns actor grants into the Credential Access Boundary rules a downscoped GCS token carries. |
|
Package gcsissuer mints GCS tokens downscoped to an actor's grants.
|
Package gcsissuer mints GCS tokens downscoped to an actor's grants. |
|
Package objectstoreplugintest provides object-store plugin clients that call the object-store plugins directly, without a socket, for tests that drive atelet or ate-api-server through the real plugin.
|
Package objectstoreplugintest provides object-store plugin clients that call the object-store plugins directly, without a socket, for tests that drive atelet or ate-api-server through the real plugin. |