publisher

package
v0.0.0-...-ed847e1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUninitializedRepositoryKeys = errors.New("uninitialized repository keys")

Functions

func NewErrIncorrectChannelName

func NewErrIncorrectChannelName(chnl string) error

func NewErrIncorrectTargetPath

func NewErrIncorrectTargetPath(path string) error

func SplitFilepath

func SplitFilepath(path string) (result []string)

TODO: move this to the separate project in github.com/werf

Types

type Filesystem

type Filesystem interface {
	IsFileExist(ctx context.Context, path string) (bool, error)

	ReadFile(ctx context.Context, path string, writer io.WriterAt) error
	ReadFileStream(ctx context.Context, path string, writer io.Writer) error
	ReadFileBytes(ctx context.Context, path string) ([]byte, error)

	WriteFileBytes(ctx context.Context, path string, data []byte) error
	WriteFileStream(ctx context.Context, path string, reader io.Reader) error
}

type InMemoryFile

type InMemoryFile struct {
	Name string
	Data []byte
}

type Interface

type Interface interface {
	GetRepository(ctx context.Context, storage logical.Storage, options RepositoryOptions) (RepositoryInterface, error)
	RotateRepositoryKeys(ctx context.Context, storage logical.Storage, repository RepositoryInterface) error
	UpdateTimestamps(ctx context.Context, storage logical.Storage, repository RepositoryInterface) error

	StageReleaseTarget(ctx context.Context, repository RepositoryInterface, releaseName, path string, data io.Reader) error
	StageChannelsConfig(ctx context.Context, repository RepositoryInterface, trdlChannelsConfig *config.TrdlChannels) error
	StageInMemoryFiles(ctx context.Context, repository RepositoryInterface, files []*InMemoryFile) error
}

type NonAtomicTufStore

type NonAtomicTufStore struct {
	PrivKeys   TufRepoPrivKeys
	Filesystem Filesystem
	// contains filtered or unexported fields
}

func NewNonAtomicTufStore

func NewNonAtomicTufStore(privKeys TufRepoPrivKeys, filesystem Filesystem) *NonAtomicTufStore

func (*NonAtomicTufStore) Clean

func (m *NonAtomicTufStore) Clean() error

func (*NonAtomicTufStore) Commit

func (store *NonAtomicTufStore) Commit(consistentSnapshot bool, versions map[string]int, _ map[string]data.Hashes) error

func (*NonAtomicTufStore) GetMeta

func (store *NonAtomicTufStore) GetMeta() (map[string]json.RawMessage, error)

func (*NonAtomicTufStore) GetSigningKeys

func (store *NonAtomicTufStore) GetSigningKeys(role string) ([]sign.Signer, error)

func (*NonAtomicTufStore) SavePrivateKey

func (store *NonAtomicTufStore) SavePrivateKey(role string, key *sign.PrivateKey) error

func (*NonAtomicTufStore) SetMeta

func (store *NonAtomicTufStore) SetMeta(name string, meta json.RawMessage) error

func (*NonAtomicTufStore) StageTargetFile

func (store *NonAtomicTufStore) StageTargetFile(ctx context.Context, path string, data io.Reader) error

func (*NonAtomicTufStore) WalkStagedTargets

func (store *NonAtomicTufStore) WalkStagedTargets(paths []string, targetsFn tuf.TargetsWalkFunc) error

type Publisher

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

func NewPublisher

func NewPublisher() *Publisher

func (*Publisher) GetRepository

func (publisher *Publisher) GetRepository(ctx context.Context, storage logical.Storage, options RepositoryOptions) (RepositoryInterface, error)

func (*Publisher) Paths

func (m *Publisher) Paths() []*framework.Path

func (*Publisher) PeriodicFunc

func (m *Publisher) PeriodicFunc(_ context.Context, _ *logical.Request) error

func (*Publisher) RotateRepositoryKeys

func (publisher *Publisher) RotateRepositoryKeys(ctx context.Context, storage logical.Storage, repository RepositoryInterface) error

func (*Publisher) StageChannelsConfig

func (publisher *Publisher) StageChannelsConfig(ctx context.Context, repository RepositoryInterface, trdlChannelsConfig *config.TrdlChannels) error

func (*Publisher) StageInMemoryFiles

func (publisher *Publisher) StageInMemoryFiles(ctx context.Context, repository RepositoryInterface, files []*InMemoryFile) error

func (*Publisher) StageReleaseTarget

func (publisher *Publisher) StageReleaseTarget(ctx context.Context, repository RepositoryInterface, releaseName, path string, data io.Reader) error

func (*Publisher) UpdateTimestamps

func (publisher *Publisher) UpdateTimestamps(ctx context.Context, storage logical.Storage, repository RepositoryInterface) error

type RepositoryInterface

type RepositoryInterface interface {
	Init() error
	SetPrivKeys(privKeys TufRepoPrivKeys) error
	GetPrivKeys() TufRepoPrivKeys
	GenPrivKeys() error

	RotatePrivKeys(ctx context.Context) (bool, TufRepoPrivKeys, error)
	UpdateTimestamps(ctx context.Context) error

	StageTarget(ctx context.Context, pathInsideTargets string, data io.Reader) error
	CommitStaged(ctx context.Context) error
}

type RepositoryOptions

type RepositoryOptions struct {
	S3Endpoint        string
	S3Region          string
	S3AccessKeyID     string
	S3SecretAccessKey string
	S3BucketName      string

	InitializeKeys bool
}

type S3Filesystem

type S3Filesystem struct {
	AwsConfig  *aws.Config
	BucketName string
}

func NewS3Filesystem

func NewS3Filesystem(awsConfig *aws.Config, bucketName string) *S3Filesystem

func (*S3Filesystem) IsFileExist

func (fs *S3Filesystem) IsFileExist(ctx context.Context, path string) (bool, error)

func (*S3Filesystem) ReadFile

func (fs *S3Filesystem) ReadFile(ctx context.Context, path string, writerAt io.WriterAt) error

func (*S3Filesystem) ReadFileBytes

func (fs *S3Filesystem) ReadFileBytes(ctx context.Context, path string) ([]byte, error)

func (*S3Filesystem) ReadFileStream

func (fs *S3Filesystem) ReadFileStream(ctx context.Context, path string, writer io.Writer) error

func (*S3Filesystem) WriteFileBytes

func (fs *S3Filesystem) WriteFileBytes(ctx context.Context, path string, data []byte) error

func (*S3Filesystem) WriteFileStream

func (fs *S3Filesystem) WriteFileStream(ctx context.Context, path string, data io.Reader) error

type S3Options

type S3Options struct {
	AwsConfig  *aws.Config
	BucketName string
}

type S3Repository

type S3Repository struct {
	S3Filesystem *S3Filesystem
	TufStore     *NonAtomicTufStore
	TufRepo      *tuf.Repo
}

func NewRepository

func NewRepository(s3Filesystem *S3Filesystem, tufStore *NonAtomicTufStore, tufRepo *tuf.Repo) *S3Repository

func NewRepositoryWithOptions

func NewRepositoryWithOptions(s3Options S3Options, tufRepoOptions TufRepoOptions) (*S3Repository, error)

func (*S3Repository) CommitStaged

func (repository *S3Repository) CommitStaged(_ context.Context) error

func (*S3Repository) GenPrivKeys

func (repository *S3Repository) GenPrivKeys() error

func (*S3Repository) GetPrivKeys

func (repository *S3Repository) GetPrivKeys() TufRepoPrivKeys

func (*S3Repository) Init

func (repository *S3Repository) Init() error

func (*S3Repository) RotatePrivKeys

func (repository *S3Repository) RotatePrivKeys(ctx context.Context) (bool, TufRepoPrivKeys, error)

func (*S3Repository) SetPrivKeys

func (repository *S3Repository) SetPrivKeys(privKeys TufRepoPrivKeys) error

func (*S3Repository) StageTarget

func (repository *S3Repository) StageTarget(ctx context.Context, pathInsideTargets string, data io.Reader) error

func (*S3Repository) UpdateTimestamps

func (repository *S3Repository) UpdateTimestamps(_ context.Context) error

type TufRepoOptions

type TufRepoOptions struct {
	PrivKeys TufRepoPrivKeys
}

type TufRepoPrivKeys

type TufRepoPrivKeys struct {
	Root      *sign.PrivateKey `json:"root"`
	Snapshot  *sign.PrivateKey `json:"snapshot"`
	Targets   *sign.PrivateKey `json:"targets"`
	Timestamp *sign.PrivateKey `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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