core

package
v0.0.0-...-d4c7a2f Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessors

type Accessors interface {
	Shards() ShardContext
	Tenants() TenantContext
	DataNodes() DataNodeContext
	Tables() TableContext
	Schema() SchemaContext
	Setting() SettingContext
	Types() TypeContext
	Users() UserContext
	Pool() PoolContext
	Sequences() SequenceContext
}

type Colony

type Colony interface {
	Accessors

	Query(string) (*frunk.QueryResponse, error)

	CoordinatorID() uint64
	IsLeader() bool
	Close()
	Addr() net.Addr
	Join(id, addr string) error
	JoinCluster() error
	LeaderID() (string, string, error)
	State() frunk.ClusterState

	Neighbors() ([]*frunk.Server, error)

	InitColony(config ColonyConfig, log timber.Logger) error
}

Colony is a wrapper for all of the core data that noahdb needs to operate.

func NewColony

func NewColony() Colony

type ColonyConfig

type ColonyConfig struct {
	DataDirectory         string
	JoinAddresses         []raft.Server
	Transport             TransportWrapper
	LocalPostgresAddress  string
	LocalPostgresPort     int32
	LocalPostgresUser     string
	LocalPostgresPassword string
	StartPool             bool
	AutoJoin              bool
}

type DataNodeContext

type DataNodeContext interface {
	GetDataNode(id uint64) (DataNode, error)
	GetDataNodes() ([]DataNode, error)
	GetDataNodesForShard(uint64) ([]DataNode, error)
	GetDataNodeForDataNodeShard(uint64) (DataNode, error)
	GetRandomDataNodeShardID() (uint64, error)
	GetDataNodeShardIDs() ([]uint64, error)
	GetDataNodeShardIDsForShard(uint64) ([]uint64, error)
	NewDataNode(address string, port int32, user string, password string) (DataNode, error)
}

type DataNodePressure

type DataNodePressure struct {
	DataNodeID uint64
	Shards     int
}

type FunctionContext

type FunctionContext interface {
}

type Listener

type Listener interface {
	net.Listener
	Dial(address string, timeout time.Duration) (net.Conn, error)
}

Listener is the interface Raft-compatible network layers should implement.

type PoolConnection

type PoolConnection interface {
	Release()
	ID() uint64
	// contains filtered or unexported methods
}

type PoolContext

type PoolContext interface {
	StartPool()
	GetConnectionForDataNodeShard(id uint64) (PoolConnection, error)
}

type SchemaContext

type SchemaContext interface {
	GetSchemas() ([]Schema, error)
	Exists(string) (bool, error)
	NewSchema(string) (Schema, error)
}

type SequenceContext

type SequenceContext interface {
	GetSequenceChunk(name string) (*frunk.SequenceChunkResponse, error)
}

type SettingContext

type SettingContext interface {
	GetSetting(SettingKeyOptions) (Setting, bool, error)
	GetSettingValue(key SettingKeyOptions) (interface{}, bool, error)
}

type ShardContext

type ShardContext interface {
	NewShard() (Shard, error)
	GetShards() ([]Shard, error)
	GetDataNodeShards() ([]DataNodeShard, error)
	GetWriteDataNodeShards(uint64) ([]DataNodeShard, error)
	BalanceOrphanShards() error
	GetDataNodesPressure(max int) ([]DataNodePressure, error)
	GetShardPressures(max int) ([]ShardPressure, error)
}

ShardContext is just a wrapper interface for shard metadata.

type ShardPressure

type ShardPressure struct {
	ShardID uint64
	Tenants int
}

type TableContext

type TableContext interface {
	NewTable(table Table, columns []Column) (Table, []Column, error)
	NextSequenceID(table Table, column Column) (uint64, error)
	GetTable(name string) (Table, bool, error)
	GetTables(...string) ([]Table, error)
	GetColumns(tableId uint64) ([]Column, error)
	GetPrimaryKeyColumnByName(name string) (Column, bool, error)
	GetSequenceColumnForTable(tableId uint64) (Column, bool, error)
	GetShardKeyColumnForTable(uint64) (Column, error)
	GetTablesInSchema(schema string, names ...string) ([]Table, error)
	GetTenantTable() (Table, bool, error)
	GetColumnFromTables(column string, tables []string) (Column, bool, error)
}

type TenantContext

type TenantContext interface {
	GetTenants() ([]Tenant, error)
	GetTenant(uint64) (Tenant, error)
	NewTenants(tenantIds ...uint64) ([]Tenant, error)
}

type TransportWrapper

type TransportWrapper interface {
	NormalTransport() net.Listener
	ForwardToRaft(net.Conn, error)
	ForwardToRpc(net.Conn, error)
	RaftTransport() Listener
	RpcTransport() Listener
	Port() int
	Addr() net.Addr
	Close()
}

func NewTransportWrapper

func NewTransportWrapper(listener Listener) TransportWrapper

type TypeContext

type TypeContext interface {
	GetTypeByName(name string) (types.Type, bool, error)
	GetTypeByOid(oid types.OID) (types.Type, bool)
}

type UserContext

type UserContext interface {
	GetUsers() ([]User, error)
}

UserContext is just a wrapper interface for user metadata.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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