Documentation
¶
Overview ¶
Package routetable provides functionality for distributed routing tables used for tracking and managing service instances and their connection states.
Index ¶
- func Key(name, color string, oid int64) string
- func NewMasterRouteTable(rtd Data, name string, opts ...Option) *masterRouteTable
- func NewReadOnlyRouteTable(rtd Data, name string) *readOnlyRouteTable
- func NewRenewalRouteTable(rtd Data, name string, opts ...Option) *renewalRouteTable
- func SplitKey(key string) (name, color string, oid int64, err error)
- type Data
- type MasterRouteTable
- type Option
- type ReNewalRouteTable
- type ReadOnlyRouteTable
- type RouteTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMasterRouteTable ¶ added in v0.0.15
NewMasterRouteTable creates a new BaseRouteTable with the given data store, name, key generation function, and optional configuration options.
func NewReadOnlyRouteTable ¶ added in v0.0.15
NewReadOnlyRouteTable creates a new readOnlyRouteTable with the given data store, name, key generation function.
func NewRenewalRouteTable ¶ added in v0.0.15
NewRenewalRouteTable creates a new renewalRouteTable with the given data store, name, key generation function, and optional configuration options.
Types ¶
type Data ¶ added in v0.0.7
type Data interface {
Get(ctx context.Context, key string) (addr string, err error)
GetEx(ctx context.Context, key string, ttl time.Duration) (addr string, err error)
BatchGet(ctx context.Context, keys []string) (addrs []string, err error)
Set(ctx context.Context, key, addr string, ttl time.Duration) error
SetNxOrGet(ctx context.Context, key, addr string, ttl time.Duration) (set bool, ret string, err error)
GetSet(ctx context.Context, key, addr string, ttl time.Duration) (old string, err error)
Expire(ctx context.Context, key string, expiration time.Duration) error
ExpireIfSame(ctx context.Context, key, value string, expiration time.Duration) error
Del(ctx context.Context, key string) error
DelIfSame(ctx context.Context, key, value string) error
}
Data is an interface for the underlying data storage of route tables.
type MasterRouteTable ¶ added in v0.0.15
type MasterRouteTable interface {
ReNewalRouteTable
GetEx(ctx context.Context, color string, oid int64) (addr string, err error)
Set(ctx context.Context, color string, key int64, addr string) error
GetSet(ctx context.Context, color string, key int64, addr string) (old string, err error)
SetNxOrGet(ctx context.Context, color string, key int64, addr string) (ok bool, result string, err error)
}
MasterRouteTable is an interface for managing routing table entries. It provides methods for storing, retrieving, and manipulating route information.
type Option ¶
type Option func(*renewalRouteTable)
Option is a function type that configures a BaseRouteTable instance.
type ReNewalRouteTable ¶ added in v0.0.12
type ReNewalRouteTable interface {
ReadOnlyRouteTable
RenewSelf(ctx context.Context, color string, key int64, value string) error
TTL() time.Duration
}
ReNewalRouteTable is an interface for read-only access to the routing table.
type ReadOnlyRouteTable ¶
type RouteTable ¶
type RouteTable interface {
MasterRouteTable
}