synchronization_server

package
v1.2.327 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrCreateClientID added in v1.1.23

func GetOrCreateClientID(ctx context.Context, projectName string, synchronizationClient *SynchronizationClient, stagesStorage storage.StagesStorage) (string, error)

func HandleRequest

func HandleRequest(w http.ResponseWriter, r *http.Request, request, response interface{}, actionFunc func())

func PerformPost

func PerformPost(client *http.Client, url string, request, response interface{}) error

func RunSynchronizationServer

func RunSynchronizationServer(_ context.Context, ip, port string, distributedLockerBackendFactoryFunc func(clientID string) (distributed_locker.DistributedLockerBackend, error), stagesStorageCacheFactoryFunc func(clientID string) (StagesStorageCacheInterface, error)) error

Types

type DeleteAllStagesRequest

type DeleteAllStagesRequest struct {
	ProjectName string `json:"projectName"`
}

type DeleteAllStagesRequestLegacy added in v1.2.0

type DeleteAllStagesRequestLegacy struct {
	ProjectName string `json:"projectName"`
}

type DeleteAllStagesResponse

type DeleteAllStagesResponse struct {
	Err util.SerializableError `json:"err"`
}

type DeleteAllStagesResponseLegacy added in v1.2.0

type DeleteAllStagesResponseLegacy struct {
	Err util.SerializableError `json:"err"`
}

type DeleteStagesByDigestRequest added in v1.2.0

type DeleteStagesByDigestRequest struct {
	ProjectName string `json:"projectName"`
	Digest      string `json:"digest"`
}

type DeleteStagesByDigestResponse added in v1.2.0

type DeleteStagesByDigestResponse struct {
	Err util.SerializableError `json:"err"`
}

type DeleteStagesBySignatureRequestLegacy added in v1.2.0

type DeleteStagesBySignatureRequestLegacy struct {
	ProjectName string `json:"projectName"`
	Signature   string `json:"signature"`
}

type DeleteStagesBySignatureResponseLegacy added in v1.2.0

type DeleteStagesBySignatureResponseLegacy struct {
	Err util.SerializableError `json:"err"`
}

type GetAllStagesRequest

type GetAllStagesRequest struct {
	ProjectName string `json:"projectName"`
}

type GetAllStagesRequestLegacy added in v1.2.0

type GetAllStagesRequestLegacy struct {
	ProjectName string `json:"projectName"`
}

type GetAllStagesResponse

type GetAllStagesResponse struct {
	Err    util.SerializableError `json:"err"`
	Found  bool                   `json:"found"`
	Stages []image.StageID        `json:"stages"`
}

type GetAllStagesResponseLegacy added in v1.2.0

type GetAllStagesResponseLegacy struct {
	Err    util.SerializableError `json:"err"`
	Found  bool                   `json:"found"`
	Stages []StageIDLegacy        `json:"stages"`
}

type GetStagesByDigestRequest added in v1.2.0

type GetStagesByDigestRequest struct {
	ProjectName string `json:"projectName"`
	Digest      string `json:"digest"`
}

type GetStagesByDigestResponse added in v1.2.0

type GetStagesByDigestResponse struct {
	Err    util.SerializableError `json:"err"`
	Found  bool                   `json:"found"`
	Stages []image.StageID        `json:"stages"`
}

type GetStagesBySignatureRequestLegacy added in v1.2.0

type GetStagesBySignatureRequestLegacy struct {
	ProjectName string `json:"projectName"`
	Signature   string `json:"signature"`
}

type GetStagesBySignatureResponseLegacy added in v1.2.0

type GetStagesBySignatureResponseLegacy struct {
	Err    util.SerializableError `json:"err"`
	Found  bool                   `json:"found"`
	Stages []StageIDLegacy        `json:"stages"`
}

type HealthRequest added in v1.1.23

type HealthRequest struct {
	Echo string `json:"echo"`
}

type HealthResponse added in v1.1.23

type HealthResponse struct {
	Err    util.SerializableError `json:"err"`
	Echo   string                 `json:"echo"`
	Status string                 `json:"status"`
}

type NewClientIDRequest added in v1.1.23

type NewClientIDRequest struct{}

type NewClientIDResponse added in v1.1.23

type NewClientIDResponse struct {
	Err      util.SerializableError `json:"err"`
	ClientID string                 `json:"clientID"`
}

type StageIDLegacy added in v1.2.0

type StageIDLegacy struct {
	Signature string `json:"signature"`

	// FIXME: rename to CreationTs
	CreationTs int64 `json:"uniqueID"`
}

type StagesStorageCacheHttpClient

type StagesStorageCacheHttpClient struct {
	URL        string
	HttpClient *http.Client
}

func NewStagesStorageCacheHttpClient

func NewStagesStorageCacheHttpClient(url string) *StagesStorageCacheHttpClient

func (*StagesStorageCacheHttpClient) DeleteAllStages

func (client *StagesStorageCacheHttpClient) DeleteAllStages(_ context.Context, projectName string) error

func (*StagesStorageCacheHttpClient) DeleteStagesByDigest added in v1.2.0

func (client *StagesStorageCacheHttpClient) DeleteStagesByDigest(_ context.Context, projectName, digest string) error

func (*StagesStorageCacheHttpClient) GetAllStages

func (client *StagesStorageCacheHttpClient) GetAllStages(_ context.Context, projectName string) (bool, []image.StageID, error)

func (*StagesStorageCacheHttpClient) GetStagesByDigest added in v1.2.0

func (client *StagesStorageCacheHttpClient) GetStagesByDigest(_ context.Context, projectName, digest string) (bool, []image.StageID, error)

func (*StagesStorageCacheHttpClient) StoreStagesByDigest added in v1.2.0

func (client *StagesStorageCacheHttpClient) StoreStagesByDigest(_ context.Context, projectName, digest string, stages []image.StageID) error

func (*StagesStorageCacheHttpClient) String

func (client *StagesStorageCacheHttpClient) String() string

type StagesStorageCacheHttpHandler

type StagesStorageCacheHttpHandler struct {
	*http.ServeMux
	StagesStorageCache StagesStorageCacheInterface
}

func NewStagesStorageCacheHttpHandler

func NewStagesStorageCacheHttpHandler(stagesStorageCache StagesStorageCacheInterface) *StagesStorageCacheHttpHandler

type StagesStorageCacheHttpHandlerLegacy added in v1.2.0

type StagesStorageCacheHttpHandlerLegacy struct {
	*http.ServeMux
	StagesStorageCache StagesStorageCacheInterface
}

func NewStagesStorageCacheHttpHandlerLegacy added in v1.2.0

func NewStagesStorageCacheHttpHandlerLegacy(stagesStorageCache StagesStorageCacheInterface) *StagesStorageCacheHttpHandlerLegacy

type StagesStorageCacheInterface added in v1.2.77

type StagesStorageCacheInterface interface {
	GetAllStages(ctx context.Context, projectName string) (bool, []image.StageID, error)
	DeleteAllStages(ctx context.Context, projectName string) error
	GetStagesByDigest(ctx context.Context, projectName, digest string) (bool, []image.StageID, error)
	StoreStagesByDigest(ctx context.Context, projectName, digest string, stages []image.StageID) error
	DeleteStagesByDigest(ctx context.Context, projectName, digest string) error

	String() string
}

type StoreStagesByDigestRequest added in v1.2.0

type StoreStagesByDigestRequest struct {
	ProjectName string          `json:"projectName"`
	Digest      string          `json:"digest"`
	Stages      []image.StageID `json:"stages"`
}

type StoreStagesByDigestResponse added in v1.2.0

type StoreStagesByDigestResponse struct {
	Err util.SerializableError `json:"err"`
}

type StoreStagesBySignatureRequestLegacy added in v1.2.0

type StoreStagesBySignatureRequestLegacy struct {
	ProjectName string          `json:"projectName"`
	Signature   string          `json:"signature"`
	Stages      []StageIDLegacy `json:"stages"`
}

type StoreStagesBySignatureResponseLegacy added in v1.2.0

type StoreStagesBySignatureResponseLegacy struct {
	Err util.SerializableError `json:"err"`
}

type SynchronizationClient added in v1.1.23

type SynchronizationClient struct {
	HttpClient *http.Client
	URL        string
}

func NewSynchronizationClient added in v1.1.23

func NewSynchronizationClient(url string) *SynchronizationClient

func (*SynchronizationClient) NewClientID added in v1.1.23

func (client *SynchronizationClient) NewClientID() (string, error)

type SynchronizationServerHandler

type SynchronizationServerHandler struct {
	*http.ServeMux

	DistributedLockerBackendFactoryFunc func(clientID string) (distributed_locker.DistributedLockerBackend, error)
	StagesStorageCacheFactoryFunc       func(clientID string) (StagesStorageCacheInterface, error)

	SynchronizationServerByClientID map[string]*SynchronizationServerHandlerByClientID
	// contains filtered or unexported fields
}

func NewSynchronizationServerHandler

func NewSynchronizationServerHandler(distributedLockerBackendFactoryFunc func(clientID string) (distributed_locker.DistributedLockerBackend, error), stagesStorageCacheFactoryFunc func(requestID string) (StagesStorageCacheInterface, error)) *SynchronizationServerHandler

type SynchronizationServerHandlerByClientID

type SynchronizationServerHandlerByClientID struct {
	*http.ServeMux
	ClientID string

	DistributedLockerBackend distributed_locker.DistributedLockerBackend
	StagesStorageCache       StagesStorageCacheInterface
}

func NewSynchronizationServerHandlerByClientID

func NewSynchronizationServerHandlerByClientID(clientID string, distributedLockerBackend distributed_locker.DistributedLockerBackend, stagesStorageCache StagesStorageCacheInterface) *SynchronizationServerHandlerByClientID

Jump to

Keyboard shortcuts

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