Documentation ¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Index ¶
- func AllowCluster() bool
- type DirCleaner
- type EmbeddedEtcd
- func (e *EmbeddedEtcd) ID() string
- func (e *EmbeddedEtcd) IsLeader() bool
- func (e *EmbeddedEtcd) Leader() *disco.Peer
- func (e *EmbeddedEtcd) NewClient() (*clientv3.Client, error)
- func (e *EmbeddedEtcd) Peers() []*disco.Peer
- func (e *EmbeddedEtcd) Shutdown()
- func (e *EmbeddedEtcd) Startup(ctx context.Context, state disco.InitialClusterState) (disco.InitialClusterState, error)
- type Etcd
- func (e *Etcd) Close() error
- func (e *Etcd) ClusterState(ctx context.Context) (out disco.ClusterState, err error)
- func (e *Etcd) CreateField(ctx context.Context, indexName string, name string, fieldVal []byte) error
- func (e *Etcd) CreateIndex(ctx context.Context, name string, val []byte) error
- func (e *Etcd) CreateView(ctx context.Context, indexName, fieldName, name string) (err error)
- func (e *Etcd) DeleteField(ctx context.Context, indexName string, name string) (err error)
- func (e *Etcd) DeleteIndex(ctx context.Context, name string) (err error)
- func (e *Etcd) DeleteNode(ctx context.Context, nodeID string) error
- func (e *Etcd) DeleteView(ctx context.Context, indexName, fieldName, name string) error
- func (e *Etcd) Field(ctx context.Context, indexName string, name string) ([]byte, error)
- func (e *Etcd) ID() string
- func (e *Etcd) Index(ctx context.Context, name string) ([]byte, error)
- func (e *Etcd) IsLeader() bool
- func (e *Etcd) Leader() *disco.Peer
- func (e *Etcd) NodeIDs() []string
- func (e *Etcd) Nodes() []*disco.Node
- func (e *Etcd) Peers() []*disco.Peer
- func (e *Etcd) PrimaryNodeID(hasher disco.Hasher) string
- func (e *Etcd) Schema(ctx context.Context) (disco.Schema, error)
- func (e *Etcd) SetMetadata(ctx context.Context, node *disco.Node) error
- func (e *Etcd) SetShards(ctx context.Context, index, field string, shards []byte) error
- func (e *Etcd) SetState(ctx context.Context, state disco.NodeState) (err error)
- func (e *Etcd) Shards(ctx context.Context, index, field string) ([][]byte, error)
- func (e *Etcd) Start(ctx context.Context) (_ disco.InitialClusterState, err error)
- func (e *Etcd) UpdateField(ctx context.Context, indexName string, name string, fieldVal []byte) error
- func (e *Etcd) View(ctx context.Context, indexName, fieldName, name string) (bool, error)
- type EtcdServicer
- type ExternalEtcd
- func (e *ExternalEtcd) ID() string
- func (e *ExternalEtcd) IsLeader() bool
- func (e *ExternalEtcd) Leader() *disco.Peer
- func (e *ExternalEtcd) NewClient() (*clientv3.Client, error)
- func (e *ExternalEtcd) Peers() []*disco.Peer
- func (e *ExternalEtcd) Shutdown()
- func (e *ExternalEtcd) Startup(ctx context.Context, state disco.InitialClusterState) (disco.InitialClusterState, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowCluster ¶
func AllowCluster() bool
allows us to conditionally build an enterprise version of FB that does cluster, in contrast to the PLG version.
Types ¶
type DirCleaner ¶
type DirCleaner interface { Cleanup(func()) Fatalf(string, ...interface{}) Logf(string, ...interface{}) Name() string TempDir() string }
DirCleaner represents the subset of the testing.TB interface we care about, allowing us to take objects which behave like that without importing all of testing to get them.
type EmbeddedEtcd ¶
type EmbeddedEtcd struct {
// contains filtered or unexported fields
}
func NewEmbeddedEtcd ¶
func NewEmbeddedEtcd(p *Etcd, opts *embed.Config) (*EmbeddedEtcd, error)
func (*EmbeddedEtcd) ID ¶
func (e *EmbeddedEtcd) ID() string
func (*EmbeddedEtcd) IsLeader ¶
func (e *EmbeddedEtcd) IsLeader() bool
func (*EmbeddedEtcd) Leader ¶
func (e *EmbeddedEtcd) Leader() *disco.Peer
func (*EmbeddedEtcd) Peers ¶
func (e *EmbeddedEtcd) Peers() []*disco.Peer
func (*EmbeddedEtcd) Shutdown ¶
func (e *EmbeddedEtcd) Shutdown()
func (*EmbeddedEtcd) Startup ¶
func (e *EmbeddedEtcd) Startup(ctx context.Context, state disco.InitialClusterState) (disco.InitialClusterState, error)
type Etcd ¶
type Etcd struct {
// contains filtered or unexported fields
}
func (*Etcd) ClusterState ¶
func (*Etcd) CreateField ¶
func (*Etcd) CreateIndex ¶
func (*Etcd) CreateView ¶
CreateView differs from CreateIndex and CreateField in that it does not return an error if the view already exists. If this logic needs to be changed, we likely need to return disco.ErrViewExists.
func (*Etcd) DeleteField ¶
func (*Etcd) DeleteView ¶
func (*Etcd) Nodes ¶
Nodes implements the Noder interface. It returns the sorted list of nodes based on the etcd peers.
func (*Etcd) PrimaryNodeID ¶
PrimaryNodeID implements the Noder interface.
func (*Etcd) UpdateField ¶
type EtcdServicer ¶
type EtcdServicer interface { Shutdown() Peers() []*disco.Peer IsLeader() bool Leader() *disco.Peer ID() string Startup(ctx context.Context, state disco.InitialClusterState) (disco.InitialClusterState, error) NewClient() (*clientv3.Client, error) }
EtcdServicer provides access to either an embeded etcd server or an external host
type ExternalEtcd ¶
type ExternalEtcd struct {
// contains filtered or unexported fields
}
func NewExternalEtcd ¶
func NewExternalEtcd(p *Etcd, o Options) (*ExternalEtcd, error)
func (*ExternalEtcd) ID ¶
func (e *ExternalEtcd) ID() string
func (*ExternalEtcd) IsLeader ¶
func (e *ExternalEtcd) IsLeader() bool
TODO this is a nonsense implementation right now will fill out when understand the issue
func (*ExternalEtcd) Leader ¶
func (e *ExternalEtcd) Leader() *disco.Peer
func (*ExternalEtcd) Peers ¶
func (e *ExternalEtcd) Peers() []*disco.Peer
func (*ExternalEtcd) Shutdown ¶
func (e *ExternalEtcd) Shutdown()
func (*ExternalEtcd) Startup ¶
func (e *ExternalEtcd) Startup(ctx context.Context, state disco.InitialClusterState) (disco.InitialClusterState, error)
type Options ¶
type Options struct { Name string `toml:"name"` Dir string `toml:"dir"` LClientURL string `toml:"listen-client-url"` AClientURL string `toml:"advertise-client-url"` LPeerURL string `toml:"listen-peer-url"` APeerURL string `toml:"advertise-peer-url"` ClusterURL string `toml:"cluster-url"` InitCluster string `toml:"initial-cluster"` ClusterName string `toml:"cluster-name"` HeartbeatTTL int64 `toml:"heartbeat-ttl"` // TLS provided tls files TrustedCAFile string `toml:"tls-trusted-cafile"` ClientCertFile string `toml:"tls-cert-file"` ClientKeyFile string `toml:"tls-key-file"` PeerCertFile string `toml:"tls-peer-cert-file"` PeerKeyFile string `toml:"tls-peer-key-file"` LPeerSocket []*net.TCPListener LClientSocket []*net.TCPListener UnsafeNoFsync bool `toml:"no-fsync"` Cluster string `toml:"static-cluster"` EtcdHosts string `toml:"etcd-hosts"` Id string }
func GenEtcdConfigs ¶
func GenEtcdConfigs(dc DirCleaner, n int) (clusterName string, cfgs []Options)
GenEtcdConfigs generates a set of etcd configs, and an initial cluster URL. It also makes temporary etcd dirs. Everything it creates is cleaned up by `dc.Cleanup` after the test/benchmark completes. On error, it calls `dc.Fatalf`, presumably terminating the test.