client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TranscoderPrefix     = "service/transcode/"
	SourcePrefix         = "service/source/"
	FanoutPrefix         = "service/fanout/"
	StreamPrefix         = "stream/"
	StreamSettingsPrefix = "streamSettings/"
)

prefixes

Variables

This section is empty.

Functions

func ParseServiceName

func ParseServiceName(path string) string

ParseServiceName parses service name from path, returns "" if path is not a service path

func ParseStreamName

func ParseStreamName(path string) string

func ParseStreamTranscoder

func ParseStreamTranscoder(path string) string

func PathIsStream

func PathIsStream(path string) bool

func PathIsStreamSettings

func PathIsStreamSettings(path string) bool

func PathIsStreamTranscoder

func PathIsStreamTranscoder(path string) bool

func ServicePath

func ServicePath(serviceName string, clientName string) string

func ServicePrefix

func ServicePrefix(prefix string) string

func StreamPath

func StreamPath(name string) string

func StreamSettingsPath

func StreamSettingsPath(name string) string

func StreamTranscoderPath

func StreamTranscoderPath(name string) string

Types

type Client

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

Client is a wrapper for a etcdv3 client

func NewEtcdClient

func NewEtcdClient(parentContext context.Context, cfg config.Network) *Client

func (*Client) Errors

func (client *Client) Errors() <-chan error

func (*Client) Get

func (client *Client) Get(ctx context.Context, key string) ([]byte, error)

func (*Client) GetWithPrefix

func (client *Client) GetWithPrefix(ctx context.Context, prefix string) ([]Field, error)

func (*Client) PublishService

func (client *Client) PublishService(ctx context.Context, service string, data string) error

publishService publishes a service endpoint on the current host

func (*Client) PublishWithLease

func (client *Client) PublishWithLease(ctx context.Context, key string, value string, ttl time.Duration) (LeaseID, error)

publishWithLease publishes a key with a new lease if the key doesn't exist yet

func (*Client) Put

func (client *Client) Put(ctx context.Context, key string, value []byte) error

func (*Client) RefreshLease

func (client *Client) RefreshLease(ctx context.Context, id LeaseID) error

func (*Client) RevokeLease

func (client *Client) RevokeLease(ctx context.Context, id LeaseID) error

func (*Client) Wait

func (client *Client) Wait()

func (*Client) Watch

func (client *Client) Watch(ctx context.Context, prefix string) (UpdateChan, error)

watch prefix and receive current state

type ConsulClient

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

func NewConsulClient

func NewConsulClient(parentContext context.Context, conf config.Network) (*ConsulClient, error)

func (*ConsulClient) Close

func (cc *ConsulClient) Close()

func (*ConsulClient) Delete

func (cc *ConsulClient) Delete(ctx context.Context, key string) error

kv delete with expiring session

func (*ConsulClient) Errors

func (cc *ConsulClient) Errors() <-chan error

func (*ConsulClient) Put

func (cc *ConsulClient) Put(ctx context.Context, key string, value []byte) error

kv put

func (*ConsulClient) PutWithSession

func (cc *ConsulClient) PutWithSession(ctx context.Context, key string, value []byte) error

func (*ConsulClient) Watch

func (cc *ConsulClient) Watch(ctx context.Context, prefix string) (UpdateChan, error)

Watch watches the consul key for changes

type ConsulKV

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

func (*ConsulKV) Key

func (c *ConsulKV) Key() string

func (*ConsulKV) Value

func (c *ConsulKV) Value() []byte

type ErrAlreadyAquired

type ErrAlreadyAquired struct {
	Key string
}

kv put with expiring session

func (*ErrAlreadyAquired) Error

func (e *ErrAlreadyAquired) Error() string

type EtcdKV

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

func (*EtcdKV) Key

func (e *EtcdKV) Key() string

func (*EtcdKV) Value

func (e *EtcdKV) Value() []byte

type Field

type Field struct {
	Key   []byte
	Value []byte
}

type KVAPI

type KVAPI interface {
	// Get(ctx context.Context, key string) ([]byte, error)
	// GetWithPrefix(ctx context.Context, prefix string) ([]Field, error)
	Put(ctx context.Context, key string, value []byte) error
	PutWithSession(ctx context.Context, key string, value []byte) error
	Delete(ctx context.Context, key string) error
}

type KeepaliveAPI

type KeepaliveAPI interface {
	RefreshLease(ctx context.Context, id LeaseID) error
	RevokeLease(ctx context.Context, id LeaseID) error
}

type KeyValue

type KeyValue interface {
	Key() string
	Value() []byte
}

type LeaseID

type LeaseID clientv3.LeaseID

type ServiceAPI

type ServiceAPI interface {
	WatchAPI
	// PublishAPI
	// KeepaliveAPI
	KVAPI
}

type UpdateChan

type UpdateChan chan []*WatchUpdate

type UpdateType

type UpdateType int
const (
	UpdateTypePut UpdateType = iota
	UpdateTypeDelete
)

type WatchAPI

type WatchAPI interface {
	// Watch Prefix
	Watch(ctx context.Context, prefix string) (UpdateChan, error)
}

type WatchUpdate

type WatchUpdate struct {
	Type UpdateType
	KV   KeyValue
}

Jump to

Keyboard shortcuts

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