sds

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSdsClientNotInit = errors.New("sds client not init")
View Source
var SubscriberRetryPeriod = 3 * time.Second

Functions

func CloseSdsClient

func CloseSdsClient()

func NewSdsClientSingleton

func NewSdsClientSingleton(cfg interface{}) types.SdsClient

TODO: support sds client index instead of singleton

func RegisterSdsStreamClientFactory added in v0.25.0

func RegisterSdsStreamClientFactory(f func(config interface{}) (SdsStreamClient, error))

func SetSdsPostCallback

func SetSdsPostCallback(fc func())

SetPostCallback

Types

type SdsClientImpl

type SdsClientImpl struct {
	SdsCallbackMap map[string]types.SdsUpdateCallbackFunc
	// contains filtered or unexported fields
}

func (*SdsClientImpl) AckResponse added in v0.27.0

func (client *SdsClientImpl) AckResponse(resp interface{})

AckResponse invoked when sds subscriber receive a response

func (*SdsClientImpl) AddUpdateCallback

func (client *SdsClientImpl) AddUpdateCallback(name string, callback types.SdsUpdateCallbackFunc) error

func (*SdsClientImpl) DeleteUpdateCallback

func (client *SdsClientImpl) DeleteUpdateCallback(name string) error

DeleteUpdateCallback

func (*SdsClientImpl) FetchSecret added in v0.27.0

func (client *SdsClientImpl) FetchSecret(ctx context.Context, name string) (*types.SdsSecret, error)

func (*SdsClientImpl) RequireSecret added in v0.27.0

func (client *SdsClientImpl) RequireSecret(name string)

func (*SdsClientImpl) SetSecret

func (client *SdsClientImpl) SetSecret(name string, secret *types.SdsSecret)

SetSecret invoked when sds subscriber get secret response

type SdsStreamClient

type SdsStreamClient interface {
	// Send creates a secret discovery request with name, and send it to server
	Send(name string) error
	// Recv receives a secret discovery response, handle it and send an ack response
	Recv(provider types.SecretProvider, callback func()) error
	// Fetch creates a secret discovery request with name, and wait the response
	Fetch(ctx context.Context, name string) (*types.SdsSecret, error)
	// AckResponse creates an ack request based on the response
	AckResponse(resp interface{})
	// Stop stops a stream client
	Stop()
}

func GetSdsStreamClient added in v0.25.0

func GetSdsStreamClient(config interface{}) (SdsStreamClient, error)

type SdsSubscriber

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

func NewSdsSubscriber

func NewSdsSubscriber(provider types.SecretProvider, sdsConfig interface{}) *SdsSubscriber

func (*SdsSubscriber) FetchSdsSecret added in v0.27.0

func (subscribe *SdsSubscriber) FetchSdsSecret(ctx context.Context, name string) (*types.SdsSecret, error)

func (*SdsSubscriber) SendAck added in v0.27.0

func (subscribe *SdsSubscriber) SendAck(resp interface{})

func (*SdsSubscriber) SendSdsRequest

func (subscribe *SdsSubscriber) SendSdsRequest(name string)

func (*SdsSubscriber) Start

func (subscribe *SdsSubscriber) Start()

func (*SdsSubscriber) Stop

func (subscribe *SdsSubscriber) Stop()

Jump to

Keyboard shortcuts

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