usecase

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	AuthRootUser(ctx context.Context, name, pwd string) error
	SignTokenForRootUser(ctx context.Context) ([]byte, error)
	VerifyTokenForRootUser(ctx context.Context, token []byte) error

	AuthBranch(ctx context.Context, branchId, timestamp, nonce, sign []byte) error
	AuthBranchWithJWT(ctx context.Context, token string) (branchId []byte, err error)
	SignTokenForBranch(ctx context.Context, branchId []byte) ([]byte, error)
	VerifyTokenForBranch(ctx context.Context, token []byte) (branchId []byte, err error)

	AuthEnv(ctx context.Context, envId, timestamp, nonce, sign []byte) error
	SignTokenForEnv(ctx context.Context, envId []byte) ([]byte, error)
	VerifyTokenForEnv(ctx context.Context, token []byte) (envId []byte, err error)

	EvictToken(ctx context.Context, token []byte) error
}

type Branch

type Branch interface {
	CreateBranch(ctx context.Context, branchName []byte) (*gateway.Branch, error)
	DeleteBranch(ctx context.Context, branchId []byte) error
	GetBranch(ctx context.Context, branchId string) (*gateway.Branch, error)
}

type CtorConfig

type CtorConfig struct {
	DaemonAdapter
	log.Logger

	Options *options
}

type DaemonAdapter

type DaemonAdapter interface {
	CreateBranch(ctx context.Context, branchName []byte) (*pb.BranchResponse, error)
	DeleteBranch(ctx context.Context, branchId []byte) error
	GetBranch(ctx context.Context, branchId string) (*pb.BranchResponse, error)
	GetBranchEncToken(ctx context.Context, branchId []byte) ([]byte, error)

	CreateEnv(ctx context.Context, branchId, envId, envName, envEncToken []byte) (*pb.EnvResponse, error)
	GetEnv(ctx context.Context, envId []byte) (*pb.EnvResponse, error)
	DeleteEnv(ctx context.Context, envId []byte) error
	GetEnvEncToken(ctx context.Context, envId []byte) ([]byte, error)
	GetEnvsWithBranchId(ctx context.Context, branchId string) ([]*pb.EnvResponse, error)

	ReleaseVersion(ctx context.Context, params *pb.VersionReleaseRequest) error
	GetVersion(ctx context.Context, envId, appVersion []byte) (*pb.VersionResponse, error)
	GetVersionList(ctx context.Context, envId []byte) ([]*pb.VersionResponse, error)
	VersionStrictCompatQuery(ctx context.Context, envId, appVersion []byte) (*pb.VersionStrictCompatQueryResponse, error)

	GenerateAccessToken(ctx context.Context, issuer pb.AccessTokenIssuer, subject string) ([]byte, error)
	VerifyAccessToken(ctx context.Context, token string) (subject []byte, err error)
	EvictAccessToken(ctx context.Context, token string) error

	UploadPkg(ctx context.Context, source multipart.File) (fileKey []byte, err error)

	GetSource(ctx context.Context, fileKey []byte) (*pb.FileSource, error)
}

type Env

type Env interface {
	CreateEnv(ctx context.Context, branchId, envId, envName, envEncToken []byte) (*gateway.Env, error)
	GetEnv(ctx context.Context, envId []byte) (*gateway.Env, error)
	DeleteEnv(ctx context.Context, envId []byte) error
	GetEnvEncToken(ctx context.Context, envId []byte) ([]byte, error)
	GetEnvsWithBranchId(ctx context.Context, branchId string) ([]*gateway.Env, error)
}

type Filer

type Filer interface {
	FileDownload(ctx context.Context, fileId []byte) ([]byte, error)
}

type Uploader

type Uploader interface {
	UploadPkg(ctx context.Context, stream multipart.File) (fileKey []byte, err error)
}

type UseCase

type UseCase interface {
	Auth
	Branch
	Env
	Version
	Uploader
	Filer
}

func New

func New(configFn func(*CtorConfig)) UseCase

type Version

type Version interface {
	ReleaseVersion(ctx context.Context, params *gateway.VersionReleaseParams) error
	GetVersion(ctx context.Context, envId, appVersion []byte) (*gateway.Version, error)
	GetVersionList(ctx context.Context, envId []byte) ([]*gateway.Version, error)
	VersionStrictCompatQuery(ctx context.Context, envId, appVersion []byte) (*gateway.VersionCompatQueryResult, error)
	VersionPkgSource(ctx context.Context, envId, appVersion string) (*gateway.FileSource, error)
}

Jump to

Keyboard shortcuts

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