plugins

package
v4.20.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var (
	ListCommitsCacheSeconds       int = 10
	AllBranchesCacheSeconds       int = 60 * 2
	AllProjectsCacheSeconds       int = 60 * 5
	GetFileContentCacheSeconds    int = 0
	GetDirectoryFilesCacheSeconds int = 0

	GetCommitCacheSeconds int = 60 * 60
)

Functions

func CacheKeyAllBranches

func CacheKeyAllBranches[T ~string | ~int | ~int64](pid T) contracts.CacheKeyInterface

func CacheKeyAllProjects

func CacheKeyAllProjects() contracts.CacheKeyInterface

func GetPlugins

func GetPlugins() map[string]contracts.PluginInterface

GetPlugins get all registered plugins.

func RegisterPlugin

func RegisterPlugin(name string, pluginInterface contracts.PluginInterface)

RegisterPlugin register plugin.

Types

type DomainManager

type DomainManager interface {
	contracts.PluginInterface

	// GetDomainByIndex domainSuffix: test.com, project: mars, namespace: default index: 0,1,2..., preOccupiedLen: 预占用的长度
	GetDomainByIndex(projectName, namespace string, index, preOccupiedLen int) string

	// GetDomain domainSuffix: test.com, project: mars, namespace: production, preOccupiedLen: 预占用的长度
	GetDomain(projectName, namespace string, preOccupiedLen int) string

	// GetCertSecretName 获取 HTTPS 证书对应的 secret
	GetCertSecretName(projectName string, index int) string

	// GetClusterIssuer CertManager 要用
	GetClusterIssuer() string

	// GetCerts 在 namespace 创建的时候注入证书信息
	GetCerts() (name, key, crt string)
}

func GetDomainManager

func GetDomainManager() DomainManager

type EmptyPubSub

type EmptyPubSub struct{}

func (*EmptyPubSub) Close

func (e *EmptyPubSub) Close() error

func (*EmptyPubSub) ID

func (e *EmptyPubSub) ID() string

func (*EmptyPubSub) Info

func (e *EmptyPubSub) Info() any

func (*EmptyPubSub) Join

func (e *EmptyPubSub) Join(projectID int64) error

func (*EmptyPubSub) Leave

func (e *EmptyPubSub) Leave(nsID int64, projectID int64) error

func (*EmptyPubSub) Publish

func (e *EmptyPubSub) Publish(nsID int64, pod *v1.Pod) error

func (*EmptyPubSub) Run

func (e *EmptyPubSub) Run(ctx context.Context) error

func (*EmptyPubSub) Subscribe

func (e *EmptyPubSub) Subscribe() <-chan []byte

func (*EmptyPubSub) ToAll

func (e *EmptyPubSub) ToAll(message contracts.WebsocketMessage) error

func (*EmptyPubSub) ToOthers

func (e *EmptyPubSub) ToOthers(message contracts.WebsocketMessage) error

func (*EmptyPubSub) ToSelf

func (e *EmptyPubSub) ToSelf(message contracts.WebsocketMessage) error

func (*EmptyPubSub) Uid

func (e *EmptyPubSub) Uid() string

type GitCacheServer

type GitCacheServer interface {
	ReCacheAllProjects() error
	ReCacheAllBranches(pid string) error
}

type GitServer

type GitServer interface {
	contracts.PluginInterface

	GetProject(pid string) (contracts.ProjectInterface, error)
	ListProjects(page, pageSize int) (contracts.ListProjectResponseInterface, error)
	AllProjects() ([]contracts.ProjectInterface, error)

	ListBranches(pid string, page, pageSize int) (contracts.ListBranchResponseInterface, error)
	AllBranches(pid string) ([]contracts.BranchInterface, error)

	GetCommit(pid string, sha string) (contracts.CommitInterface, error)
	GetCommitPipeline(pid string, sha string) (contracts.PipelineInterface, error)
	ListCommits(pid string, branch string) ([]contracts.CommitInterface, error)

	GetFileContentWithBranch(pid string, branch string, filename string) (string, error)
	GetFileContentWithSha(pid string, sha string, filename string) (string, error)

	GetDirectoryFilesWithBranch(pid string, branch string, path string, recursive bool) ([]string, error)
	GetDirectoryFilesWithSha(pid string, sha string, path string, recursive bool) ([]string, error)
}

func GetGitServer

func GetGitServer() GitServer

type PictureInterface

type PictureInterface interface {
	contracts.PluginInterface

	// Get picture.
	Get(ctx context.Context, random bool) (*contracts.Picture, error)
}

func GetPicture

func GetPicture() PictureInterface

type WsSender

type WsSender interface {
	contracts.PluginInterface

	// New contracts.PubSub
	New(uid, id string) contracts.PubSub
}

func GetWsSender

func GetWsSender() WsSender

Jump to

Keyboard shortcuts

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