connection

package
v0.0.0-...-97dd610 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypeSupported

func TypeSupported(t string) bool

Types

type ClientStatus

type ClientStatus struct {
	PushQueued    bool
	PushingStatus PushingStatus

	NonceInc int64

	ClientVersion *VersionedRule

	LastPushedTime    int64
	LastPushedVersion *VersionedRule
	LastPushNonce     string
}

type Connection

type Connection struct {
	EndpointConnection EndpointConnection
	Endpoint           *rule.Endpoint

	TypeListened map[string]bool

	RawRuleQueue  workqueue.Interface
	ExpectedRules map[string]*VersionedRule
	ClientRules   map[string]*ClientStatus
	// contains filtered or unexported fields
}

type ConnectionStatus

type ConnectionStatus int
const (
	Connected ConnectionStatus = iota
	Disconnected
)

type EndpointConnection

type EndpointConnection interface {
	Send(*ObserveResponse) error
	Recv() (*ObserveRequest, error)
	Disconnect()
}

type ObserveRequest

type ObserveRequest struct {
	Nonce string
	Type  string
}

type ObserveResponse

type ObserveResponse struct {
	Nonce string
	Type  string
	Data  rule.ToClient
}

type PushingStatus

type PushingStatus int
const (
	Pushed PushingStatus = iota
	Pushing
)

type Storage

type Storage struct {
	Mutex      *sync.RWMutex
	Connection []*Connection

	LatestRules map[string]rule.Origin
}

func NewStorage

func NewStorage() *Storage

func (*Storage) Connected

func (s *Storage) Connected(endpoint *rule.Endpoint, connection EndpointConnection)

func (*Storage) Disconnect

func (s *Storage) Disconnect(c *Connection)

func (*Storage) HandleRequest

func (s *Storage) HandleRequest(c *Connection, req *ObserveRequest)

type VersionedRule

type VersionedRule struct {
	Revision int64
	Type     string
	Data     rule.ToClient
}

Jump to

Keyboard shortcuts

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