core

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug bool
	// DbURL contains username and password
	DbURL          string
	DbName         string
	GetSizer       fs.GetSizer
	DockerEndpoint string
}

Config contains a list of options used when creating `Core`.

type Core

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

Core is the basic type of this package. It provides methods for interaction with MongoDB and Docker API.

func NewWithConfig

func NewWithConfig(cfg Config) (*Core, error)

NewWithConfig returns a `Core` instance with specified config.

func (*Core) AddMeta

func (c *Core) AddMeta(ms ...*api.Meta) error

AddMeta inserts one or more Metas.

func (*Core) AddRepository

func (c *Core) AddRepository(repos ...api.Repository) error

AddRepository creates one or more Repositories.

func (*Core) CloseMongoSession

func (c *Core) CloseMongoSession()

func (*Core) FindMeta

func (c *Core) FindMeta(query interface{}) *mgo.Query

FindMeta simply re-export the mgo API.

func (*Core) FindRepository

func (c *Core) FindRepository(query interface{}) *mgo.Query

FindRepository simply re-export the mgo API.

func (*Core) GetContainerLogs

func (c *Core) GetContainerLogs(ctx context.Context, opts LogsOptions) error

GetContainerLogs gets all stdout and stderr logs from the given container.

func (*Core) GetMeta

func (c *Core) GetMeta(name string) (*api.Meta, error)

GetMeta returns the metadata of the given Repository.

func (*Core) GetRepository

func (c *Core) GetRepository(name string) (*api.Repository, error)

GetRepository returns the Repository with the given name.

func (*Core) GetSize

func (c *Core) GetSize(dir string) int64

func (*Core) InitMetas

func (c *Core) InitMetas()

InitMetas creates metadata for each Repository.

func (*Core) ListAllMetas

func (c *Core) ListAllMetas() []api.Meta

ListAllMetas returns the list of metadata of all Repositories.

func (*Core) ListAllRepositories

func (c *Core) ListAllRepositories() []api.Repository

ListAllRepositories returns all Repositories.

func (*Core) ListContainers

func (c *Core) ListContainers(ctx context.Context, filter map[string][]string) ([]types.Container, error)

ListContainers returns a list of containers.

func (*Core) ListImages

func (c *Core) ListImages(ctx context.Context, filter map[string][]string) ([]types.ImageSummary, error)

ListImages returns a list of docker images.

func (*Core) PingMongoSession

func (c *Core) PingMongoSession() error

func (*Core) PullImage

func (c *Core) PullImage(ctx context.Context, img string) error

PullImage pulls an image from remote registry.

func (*Core) RemoveContainer

func (c *Core) RemoveContainer(ctx context.Context, id string) error

RemoveContainer removes the given container.

func (*Core) RemoveImage

func (c *Core) RemoveImage(ctx context.Context, id string) error

RemoveImage removes the given docker image.

func (*Core) RemoveMeta

func (c *Core) RemoveMeta(name string) error

RemoveMeta removes the metadata of the given Repository.

func (*Core) RemoveRepository

func (c *Core) RemoveRepository(name string) error

RemoveRepository removes the Repository with given name.

func (*Core) StopContainer

func (c *Core) StopContainer(ctx context.Context, id string) error

StopContainer stops the given container.

func (*Core) Sync

func (c *Core) Sync(ctx context.Context, opts SyncOptions) (*api.Container, error)

Sync creates and starts a predefined container to sync local repository.

func (*Core) UpdatePrevRun

func (c *Core) UpdatePrevRun(name string) error

func (*Core) UpdateRepository

func (c *Core) UpdateRepository(name string, update bson.M) error

UpdateRepository updates the syncing options of the given Repository.

func (*Core) UpsertRepoMeta

func (c *Core) UpsertRepoMeta(name, dir string, code int) error

UpsertRepoMeta updates the metadata of the given Repository.

func (*Core) WaitContainer

func (c *Core) WaitContainer(ctx context.Context, id string) (int, error)

WaitContainer blocks until the given container exits.

type LogsOptions

type LogsOptions struct {
	ID     string
	Stream io.Writer
	Tail   string
	Follow bool
}

LogsOptions provides params to the GetContainerLogs function.

type SyncOptions

type SyncOptions struct {
	Name          string
	LogDir        string
	DefaultOwner  string
	DefaultBindIP string
	NamePrefix    string
	Debug         bool
	MountDir      bool
}

SyncOptions provides params to the Sync function.

Jump to

Keyboard shortcuts

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