types

package
v0.0.0-...-4957362 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrPort

type AddrPort struct {
	netip.AddrPort
}

AddrPort is a wrapper for netip.AddrPort for which (json/yaml).(Marshaller/Unmarshaller) are implemented.

func ParseAddrPort

func ParseAddrPort(addrPortStr string) (AddrPort, error)

ParseAddrPort parses an IPv4/IPv6 address and port string into an AddrPort.

func (AddrPort) MarshalJSON

func (a AddrPort) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for the AddrPort type.

func (AddrPort) MarshalYAML

func (a AddrPort) MarshalYAML() (any, error)

MarshalYAML implements yaml.Marshaler for the AddrPort type. Note that for yaml we just need to return a yaml marshallable type (if we return []byte as in the json implementation it is written as an int array).

func (AddrPort) String

func (a AddrPort) String() string

String returns the string representation of the AddrPort, or an empty string if it is empty.

func (*AddrPort) UnmarshalJSON

func (a *AddrPort) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for AddrPort.

func (*AddrPort) UnmarshalYAML

func (a *AddrPort) UnmarshalYAML(unmarshal func(v any) error) error

UnmarshalYAML implements yaml.Unmarshaler for AddrPort.

type AddrPorts

type AddrPorts []AddrPort

AddrPorts is a defined type for a slice of AddrPort. This facilitates convenience functions.

func ParseAddrPorts

func ParseAddrPorts(addrPortStrs []string) (AddrPorts, error)

ParseAddrPorts parses a list of IPv4/IPv6 address and port strings into an AddrPorts.

func (AddrPorts) SelectRandom

func (a AddrPorts) SelectRandom() AddrPort

SelectRandom returns a randomly selected AddrPort from AddrPorts.

func (AddrPorts) Strings

func (a AddrPorts) Strings() []string

Strings returns a string slice of the AddrPorts.

type CertificateName

type CertificateName string

CertificateName represents the name of a certificate.

const (
	// ClusterCertificateName represents the name of the cluster certificate used by the core API.
	ClusterCertificateName CertificateName = "cluster"

	// ServerCertificateName represents the name of the identifying certificate of a cluster member.
	ServerCertificateName CertificateName = "server"
)

type ClusterCertificatePut

type ClusterCertificatePut struct {
	PublicKey  string `json:"public_key"  yaml:"public_key"`
	PrivateKey string `json:"private_key" yaml:"private_key"`
	CA         string `json:"ca"          yaml:"ca"`
}

ClusterCertificatePut represents the content of a new cluster keypair and CA.

type ClusterMember

type ClusterMember struct {
	ClusterMemberLocal
	Role                  string                `json:"role" yaml:"role"`
	SchemaInternalVersion uint64                `json:"schema_internal_version" yaml:"schema_internal_version"`
	SchemaExternalVersion uint64                `json:"schema_external_version" yaml:"schema_external_version"`
	LastHeartbeat         time.Time             `json:"last_heartbeat" yaml:"last_heartbeat"`
	Status                MemberStatus          `json:"status" yaml:"status"`
	Extensions            extensions.Extensions `json:"extensions" yaml:"extensions"`
	Secret                string                `json:"secret" yaml:"secret"`
}

ClusterMember represents information about a dqlite cluster member.

type ClusterMemberLocal

type ClusterMemberLocal struct {
	Name        string          `json:"name" yaml:"name"`
	Address     AddrPort        `json:"address" yaml:"address"`
	Certificate X509Certificate `json:"certificate" yaml:"certificate"`
}

ClusterMemberLocal represents local information about a new cluster member.

type DaemonConfig

type DaemonConfig struct {
	Name    string                  `json:"name" yaml:"name"`
	Address AddrPort                `json:"address" yaml:"address"`
	Servers map[string]ServerConfig `json:"servers" yaml:"servers"`
}

DaemonConfig is the in memory version of the local daemon.yaml file.

type DatabaseStatus

type DatabaseStatus string

DatabaseStatus is the current status of the database.

const (
	// DatabaseReady indicates the database is open for use.
	DatabaseReady DatabaseStatus = "Database is online"

	// DatabaseWaiting indicates the database is blocked on a schema or API extension upgrade.
	DatabaseWaiting DatabaseStatus = "Database is waiting for an upgrade"

	// DatabaseStarting indicates the daemon is running, but dqlite is still in the process of starting up.
	DatabaseStarting DatabaseStatus = "Database is still starting"

	// DatabaseNotReady indicates the database is not yet ready for use.
	DatabaseNotReady DatabaseStatus = "Database is not yet initialized"

	// DatabaseOffline indicates that the database is offline.
	DatabaseOffline DatabaseStatus = "Database is offline"
)

type EndpointPrefix

type EndpointPrefix string

EndpointPrefix is a type specifying the endpoint on which the resource exists.

type KeyPair

type KeyPair struct {
	Cert string `json:"cert" yaml:"cert"`
	Key  string `json:"key" yaml:"key"`
	CA   string `json:"ca" yaml:"ca"`
}

KeyPair holds a certificate together with its private key and optional CA.

type MemberStatus

type MemberStatus string

MemberStatus represents the online status of a cluster member.

const (
	// MemberOnline should be the MemberStatus when the node is online and reachable.
	MemberOnline MemberStatus = "ONLINE"

	// MemberUnreachable should be the MemberStatus when we were not able to connect to the node.
	MemberUnreachable MemberStatus = "UNREACHABLE"

	// MemberNotTrusted should be the MemberStatus when there is no local yaml entry for this node.
	MemberNotTrusted MemberStatus = "NOT TRUSTED"

	// MemberNotFound should be the MemberStatus when the node was not found in dqlite.
	MemberNotFound MemberStatus = "NOT FOUND"

	// MemberUpgrading should be the MemberStatus if the system is awaiting or performing a schema upgrade.
	MemberUpgrading MemberStatus = "UPGRADING"

	// MemberNeedsUpgrade should be the MemberStatus if the system needs to receive a schema upgrade to be compatible with other cluster members.
	MemberNeedsUpgrade MemberStatus = "NEEDS UPGRADE"
)

type ServerConfig

type ServerConfig struct {
	// Address is the server listen address.
	// Example: 127.0.0.1:9000
	Address AddrPort `json:"address" yaml:"address"`
}

ServerConfig represents the mutable fields of an additional network listener.

type X509Certificate

type X509Certificate struct {
	*x509.Certificate
}

X509Certificate is a json/yaml marshallable/unmarshallable type wrapper for x509.Certificate.

func ParseX509Certificate

func ParseX509Certificate(certStr string) (*X509Certificate, error)

ParseX509Certificate decodes the given PEM encoded string and parses it into an X509Certificate.

func (X509Certificate) MarshalJSON

func (c X509Certificate) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for X509Certificate.

func (X509Certificate) MarshalYAML

func (c X509Certificate) MarshalYAML() (any, error)

MarshalYAML implements yaml.Marshaller for X509Certificate.

func (X509Certificate) String

func (c X509Certificate) String() string

String returns the x509.Certificate as a PEM encoded string.

func (*X509Certificate) UnmarshalJSON

func (c *X509Certificate) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler for X509Certificate.

func (*X509Certificate) UnmarshalYAML

func (c *X509Certificate) UnmarshalYAML(unmarshal func(v any) error) error

UnmarshalYAML implements yaml.Unmarshaler for X509Certificate.

Jump to

Keyboard shortcuts

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