backend

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ROUTING_QUERY = `` /* 181-byte string literal not displayed */

Denormalize the routing table to make post-processing easier

View Source
const VERSION_QUERY = `` /* 250-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func NewBackend

func NewBackend(logger *log.Logger, username, password string, uri string, hosts ...string) (*Backend, error)

func (*Backend) Authenticate

func (b *Backend) Authenticate(hello *bolt.Message) (map[string]bolt.BoltConn, error)

For now, we'll authenticate to all known hosts up-front to simplify things. So for a given Hello message, use it to auth against all hosts known in the current routing table.

Returns an map[string] of hosts to bolt.BoltConn's if successful, an empty map and an error if not.

func (*Backend) ClusterInfo added in v0.4.0

func (b *Backend) ClusterInfo() (ClusterInfo, error)

func (*Backend) RoutingTable

func (b *Backend) RoutingTable(db string) (RoutingTable, error)

func (*Backend) Version added in v0.2.0

func (b *Backend) Version() Version

type ClusterInfo added in v0.4.0

type ClusterInfo struct {
	DefaultDb string
	Ttl       time.Duration
	Hosts     []string
	CreatedAt time.Time
}

func (ClusterInfo) String added in v0.4.0

func (i ClusterInfo) String() string

type Monitor

type Monitor struct {
	Info <-chan ClusterInfo

	Version Version
	Ttl     time.Duration
	Host    string
	// contains filtered or unexported fields
}

TODO: what the hell are we doing here?

func NewMonitor

func NewMonitor(user, password, uri string, hosts ...string) (*Monitor, error)

Construct and start a new routing table Monitor using the provided user, password, and uri as arguments to the underlying neo4j.Driver. Returns a pointer to the Monitor on success, or nil and an error on failure.

Any additional hosts provided will be used as part of a custom address resolution function via the neo4j.Driver.

func (*Monitor) Stop

func (m *Monitor) Stop()

func (Monitor) UpdateRoutingTable added in v0.4.0

func (m Monitor) UpdateRoutingTable(db string) (RoutingTable, error)

type RoutingTable

type RoutingTable struct {
	Name                      string
	Readers, Writers, Routers []string
	CreatedAt                 time.Time
	Ttl                       time.Duration
}

func (RoutingTable) Expired

func (rt RoutingTable) Expired() bool

func (RoutingTable) String

func (t RoutingTable) String() string

type Version added in v0.2.0

type Version struct {
	Major, Minor, Patch uint8
	Extra               string
}

func ParseVersion added in v0.2.0

func ParseVersion(buf []byte) (Version, error)

func (Version) Bytes added in v0.2.0

func (v Version) Bytes() []byte

func (Version) String added in v0.2.0

func (v Version) String() string

Jump to

Keyboard shortcuts

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