client

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, cfg *Configuration) (c *Client, err error)

func (*Client) AddCompletedLayers

func (c *Client) AddCompletedLayers(compressedLayerDigest string)

func (*Client) Close

func (c *Client) Close()

func (*Client) FindBaseImage

func (c *Client) FindBaseImage(base, ref string) (img containerd.Image, err error)

FindBaseImage find the closest available image for the requested image, if user appointed an image, then this function will be used for confirming the appointed image is available in the local storage

func (*Client) GetFilesystemPath

func (c *Client) GetFilesystemPath(cd string) string

func (*Client) GetFilesystemRoot

func (c *Client) GetFilesystemRoot() string

func (*Client) GetMountingPoint

func (c *Client) GetMountingPoint(ssId string) string

func (*Client) InitCLIServer

func (c *Client) InitCLIServer() (err error)

func (*Client) InitSnapshotter

func (c *Client) InitSnapshotter() (err error)

InitSnapshotter initializes the snapshotter service

func (*Client) LoadImage

func (c *Client) LoadImage(manifest digest.Digest) (manager *Manager, err error)

LoadImage loads image manifest from content store to the memory, if it is in memory, return manager directly.

This method should not use any snapshotter methods to avoid recursive lock. This method is similar to PullImage, but it only uses content store.

func (*Client) Mount

func (c *Client) Mount(ld digest.Digest, ssId string, sn *snapshots.Info) (mnt string, err error)

Mount returns the mountpoint for the given snapshot - md: manifest digest - ld: uncompressed layer digest - ssId: snapshot id

func (*Client) Notify added in v0.2.1

func (c *Client) Notify(proxyCfg string, reference name.Reference) error

func (*Client) Ping added in v0.2.1

func (c *Client) Ping(proxyCfg string) (int64, string, string, error)

func (*Client) PrepareManager added in v0.2.1

func (c *Client) PrepareManager(manifest digest.Digest) (err error)

func (*Client) PullImage

func (c *Client) PullImage(base containerd.Image, ref, platform, proxyCfg string, ready *chan bool) (img containerd.Image, closedReady bool, err error)

PullImage pulls an image from a registry and stores it in the content store it also stores the manager in memory. In case there exists another manager in memory, it removes it and re-pull the image

func (*Client) StartCLIServer

func (c *Client) StartCLIServer()

func (*Client) StartSnapshotter

func (c *Client) StartSnapshotter()

StartSnapshotter starts the snapshotter service, should be run in a goroutine

func (*Client) Unmount

func (c *Client) Unmount(cd, sn string) error

func (*Client) UploadTraces

func (c *Client) UploadTraces(proxyCfg string, tc *fs.TraceCollection) error

type Configuration

type Configuration struct {
	LogLevel string `json:"log_level"`
	ClientId string `json:"id"`

	// path to database
	Metadata string `json:"metadata"`

	// socket address
	Socket     string `json:"socket"`
	DaemonType string `json:"daemon_type"`
	Daemon     string `json:"daemon"`
	Containerd string `json:"containerd"`
	Namespace  string `json:"default_namespace"`
	TracesDir  string `json:"traces_dir"`

	// registry + proxy
	DefaultProxy   string `json:"default_proxy"`
	FileSystemRoot string `json:"fs_root"`

	Proxies map[string]*ProxyConfig `json:"configs"`
}

func LoadConfig

func LoadConfig(cfgPath string) (c *Configuration, p string, n bool, error error)

func NewConfig

func NewConfig() *Configuration

func (*Configuration) SaveConfig

func (c *Configuration) SaveConfig() error

type Manager

type Manager struct {
	receive.DeltaBundle
	// contains filtered or unexported fields
}

Manager should be unmarshalled from a json file and then Populate() should be called to populate other fields

func (*Manager) CreateSnapshots

func (m *Manager) CreateSnapshots(c *Client) (chainIds []digest.Digest, err error)

CreateSnapshots for chainIds should unlock the managerMapLock before calling CreateSnapshot

func (*Manager) Extract

func (m *Manager) Extract(r *io.ReadCloser) (err error)

func (*Manager) GetPathBySerial added in v0.2.1

func (m *Manager) GetPathBySerial(serial int64) string

func (*Manager) GetPathByStack added in v0.2.1

func (m *Manager) GetPathByStack(stack int64) string

func (*Manager) Init

func (m *Manager) Init(ctx context.Context, cfg *Configuration, ready bool,
	manifest *v1.Manifest, imageConfig *v1.Image, manifestDigest digest.Digest)

Init populates the manager with the necessary information and data structures. Use json.Unmarshal to unmarshal the json file from data storage into a Manager struct.

  • ready: if set to false, we will then use Extract() to get the content of the file
  • cfg: configuration of the client
  • image, manifest, imageConfig: information about the image (maybe we don't need this)

do not change any outside state, only the manager itself

func (*Manager) LogTrace

func (m *Manager) LogTrace(stack int64, filename string, access, complete time.Time)

func (*Manager) LookUpFile

func (m *Manager) LookUpFile(stack int64, filename string) fs.ReceivedFile

func (*Manager) NewStarlightFS

func (m *Manager) NewStarlightFS(mount string, stack int64, options *fusefs.Options, debug bool) (f *fs.Instance, err error)

NewStarlightFS creates FUSE server and mount to provided mount directory

func (*Manager) PrepareDirectories

func (m *Manager) PrepareDirectories(c *Client) error

func (*Manager) SetOptimizerOff

func (m *Manager) SetOptimizerOff() (duration time.Duration, err error)

func (*Manager) SetOptimizerOn

func (m *Manager) SetOptimizerOn(optimizeGroup string) (starTime time.Time, err error)

func (*Manager) String

func (m *Manager) String() string

func (*Manager) Teardown

func (m *Manager) Teardown()

type ProxyConfig

type ProxyConfig struct {
	Protocol string `json:"protocol"`
	Address  string `json:"address"`

	// Auth
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

func ParseProxyStrings

func ParseProxyStrings(v string) (name string, c *ProxyConfig, err error)

type StarlightDaemonAPIServer

type StarlightDaemonAPIServer struct {
	pb.UnimplementedDaemonServer
	// contains filtered or unexported fields
}

func (*StarlightDaemonAPIServer) AddProxyProfile

func (s *StarlightDaemonAPIServer) AddProxyProfile(ctx context.Context, req *pb.AuthRequest) (*pb.AuthResponse, error)

func (*StarlightDaemonAPIServer) GetVersion added in v0.2.2

func (s *StarlightDaemonAPIServer) GetVersion(ctx context.Context, req *pb.Request) (*pb.Version, error)

func (*StarlightDaemonAPIServer) NotifyProxy added in v0.2.1

func (*StarlightDaemonAPIServer) PingTest added in v0.2.1

func (*StarlightDaemonAPIServer) PullImage

func (s *StarlightDaemonAPIServer) PullImage(ctx context.Context, ref *pb.ImageReference) (resp *pb.ImagePullResponse, err error)

func (*StarlightDaemonAPIServer) ReportTraces

func (*StarlightDaemonAPIServer) SetOptimizer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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