eventlog

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLockNotAcquired = errors.New("lock not acquired")
View Source
var ErrOutputEventStucked = errors.New("output event stucked")
View Source
var ErrPositionNotFound = errors.New("position not found")

Functions

func NewEventlogSyncEtcd

func NewEventlogSyncEtcd(client *clientv3.Client) (*eventlogSyncEtcd, error)

func NewEventlogSyncFile

func NewEventlogSyncFile(directory string) (*eventlogSyncFile, error)

Types

type Client

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

func NewClient

func NewClient(instanceID string, tunnelHost string, eventlogSync EventlogSync, opt ...Option) (*Client, error)

func (*Client) Close

func (s *Client) Close()

func (*Client) Events

func (s *Client) Events() chan *Event

type Event

type Event struct {
	Timestamp int64
	EventType proto.EventType
	PeerInfo  *proto.PeerInfo
	Error     error
}

type EventlogSync

type EventlogSync interface {
	Acquire(instanceID string, tunnelID string, ttl time.Duration) (bool, error)
	Release(instanceID string, tunnelID string) error

	GetPosition(tunnelID string) (Position, error)
	PutPosition(tunnelID string, position Position) error
	DeletePosition(tunnelID string) error
}

type Option

type Option func(opts *options) error

func WithAuthSecret

func WithAuthSecret(authSecret string) Option

func WithLockProlongateTimeout

func WithLockProlongateTimeout(lockProlongateTimeout time.Duration) Option

func WithLockTtl

func WithLockTtl(lockTtl time.Duration) Option

func WithNoSSL

func WithNoSSL() Option

func WithReportPositionInterval

func WithReportPositionInterval(reportPositionInterval time.Duration) Option

func WithSelfSignedTLS

func WithSelfSignedTLS() Option

func WithStartFromActiveLog

func WithStartFromActiveLog() Option

func WithStopIdleTimeout

func WithStopIdleTimeout(stopIdleTimeout time.Duration) Option

func WithTunnelPort

func WithTunnelPort(port string) Option

func WithWaitOutputWriteTimeout

func WithWaitOutputWriteTimeout(waitOutputWriteTimeout time.Duration) Option

type Position

type Position struct {
	LogID  string `json:"log_id"`
	Offset int64  `json:"offset"`
}

func (*Position) ToJson

func (s *Position) ToJson() string

Jump to

Keyboard shortcuts

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