core

package
v0.0.0-...-a6492d2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	// Drops v1版本只存放要干掉哪些,add仍旧由smserver在guard阶段下发
	Drops []string `json:"drops"`
}

type MockedShardPrimitives

type MockedShardPrimitives struct {
	mock.Mock
}

func (*MockedShardPrimitives) Add

func (*MockedShardPrimitives) Drop

func (m *MockedShardPrimitives) Drop(id string) error

type ShardKeeper

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

ShardKeeper 参考raft中log replication节点的实现机制,记录日志到boltdb,开goroutine异步下发指令给调用方

func NewShardKeeper

func NewShardKeeper(opts *ShardKeeperOptions, st storage.Storage) (*ShardKeeper, error)

func (*ShardKeeper) Add

func (sk *ShardKeeper) Add(id string, spec *storage.ShardSpec) error

func (*ShardKeeper) Close

func (sk *ShardKeeper) Close()

func (*ShardKeeper) Drop

func (sk *ShardKeeper) Drop(id string) error

func (*ShardKeeper) Storage

func (sk *ShardKeeper) Storage() storage.Storage

func (*ShardKeeper) WatchLease

func (sk *ShardKeeper) WatchLease()

WatchLease 监听lease节点,及时参与到rb中

type ShardKeeperOptions

type ShardKeeperOptions struct {
	Service          string
	ContainerId      string
	DropExpiredShard bool
	Client           etcdutil.EtcdWrapper
	ShardDir         string
	AppShardImpl     ShardPrimitives
}

ShardKeeperOptions copy from containerOptions

type ShardLease

type ShardLease struct {
	storage.Lease

	// GuardLeaseID 不是clientv3.NoLease ,代表是bridge阶段,且要求本地shard的lease属性是该值
	GuardLeaseID clientv3.LeaseID `json:"guardLeaseID"`

	// BridgeLeaseID 在guard阶段,要求本地的bridge是这个值
	BridgeLeaseID clientv3.LeaseID `json:"bridgeLeaseID"`

	// Assignment 包含本轮需要drop掉的shard
	Assignment *Assignment `json:"assignment"`
}

func (*ShardLease) String

func (sl *ShardLease) String() string

type ShardPrimitives

type ShardPrimitives interface {
	Add(id string, spec *storage.ShardSpec) error
	Drop(id string) error
}

Jump to

Keyboard shortcuts

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