repo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

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

func NewDao

func NewDao(conf *config.Configuration) (*Dao, error)

func (*Dao) Close

func (dao *Dao) Close() error

func (*Dao) CountEdges

func (dao *Dao) CountEdges() (int, error)

func (*Dao) CountFrontiers

func (dao *Dao) CountFrontiers() (int, error)

func (*Dao) CountServices

func (dao *Dao) CountServices() (int, error)

func (*Dao) DeleteEdge

func (dao *Dao) DeleteEdge(edgeID uint64) error

we keep edge but delete alive:edge

func (*Dao) DeleteFrontier

func (dao *Dao) DeleteFrontier(frontier string) error

we keep frontier but delete alive:frontier

func (*Dao) DeleteService

func (dao *Dao) DeleteService(serviceID uint64, frontierID string) error

func (*Dao) ExpireEdge

func (dao *Dao) ExpireEdge(edgeID uint64, expiration time.Duration) error

func (*Dao) ExpireFrontier

func (dao *Dao) ExpireFrontier(frontier string, expiration time.Duration) error

func (*Dao) ExpireService

func (dao *Dao) ExpireService(serviceID uint64, expiration time.Duration) error

func (*Dao) GetAllEdgeIDs

func (dao *Dao) GetAllEdgeIDs() ([]uint64, error)

care about the performance

func (*Dao) GetAllFrontierIDs

func (dao *Dao) GetAllFrontierIDs() ([]string, error)

func (*Dao) GetAllFrontiers

func (dao *Dao) GetAllFrontiers() ([]*Frontier, error)

func (*Dao) GetAllServiceIDs

func (dao *Dao) GetAllServiceIDs() ([]uint64, error)

func (*Dao) GetEdge

func (dao *Dao) GetEdge(edgeID uint64) (*Edge, error)

func (*Dao) GetEdges

func (dao *Dao) GetEdges(edgeIDs []uint64) ([]*Edge, error)

func (*Dao) GetEdgesByCursor

func (dao *Dao) GetEdgesByCursor(query *EdgeQuery) ([]*Edge, uint64, error)

func (*Dao) GetFrontier

func (dao *Dao) GetFrontier(frontierID string) (*Frontier, error)

func (*Dao) GetFrontiers

func (dao *Dao) GetFrontiers(frontierIDs []string) ([]*Frontier, error)

func (*Dao) GetFrontiersByCursor

func (dao *Dao) GetFrontiersByCursor(query *FrontierQuery) ([]*Frontier, uint64, error)

func (*Dao) GetService

func (dao *Dao) GetService(serviceID uint64) (*Service, error)

func (*Dao) GetServices

func (dao *Dao) GetServices(serviceIDs []uint64) ([]*Service, error)

func (*Dao) GetServicesByCursor

func (dao *Dao) GetServicesByCursor(query *ServiceQuery) ([]*Service, uint64, error)

func (*Dao) SetEdge

func (dao *Dao) SetEdge(edgeID uint64, edge *Edge) error

obsoleted

func (*Dao) SetEdgeAndAlive

func (dao *Dao) SetEdgeAndAlive(edgeID uint64, edge *Edge, expiration time.Duration) error

func (*Dao) SetFrontier

func (dao *Dao) SetFrontier(frontierID string, frontier *Frontier) error

obsoleted

func (*Dao) SetFrontierAndAlive

func (dao *Dao) SetFrontierAndAlive(frontierID string, frontier *Frontier, expiration time.Duration) (bool, error)

func (*Dao) SetFrontierCount

func (dao *Dao) SetFrontierCount(frontierID string, edgeCount, serviceCount int) error

func (*Dao) SetFrontierEdgeCount

func (dao *Dao) SetFrontierEdgeCount(frontierID string, edgeCount int) error

obsoleted

func (*Dao) SetFrontierServiceCount

func (dao *Dao) SetFrontierServiceCount(frontierID string, serviceCount int) error

obsoleted

func (*Dao) SetService

func (dao *Dao) SetService(serviceID uint64, service *Service) error

obsoleted

func (*Dao) SetServiceAndAlive

func (dao *Dao) SetServiceAndAlive(serviceID uint64, service *Service, expiration time.Duration) error

type Edge

type Edge struct {
	FrontierID string `json:"frontier_id"`
	Addr       string `json:"addr"`
	UpdateTime int64  `json:"update_time"`
}

key: edgeID; value: Edge

type EdgeQuery

type EdgeQuery struct {
	Cursor uint64
	Count  int64
}

type Frontier

type Frontier struct {
	FrontierID                 string `yaml:"frontier_id"`
	AdvertisedServiceboundAddr string `yaml:"advertised_sb_addr"`
	AdvertisedEdgeboundAddr    string `yaml:"advertised_eb_addr"`
	EdgeCount                  int    `yaml:"edge_count"`
	ServiceCount               int    `yaml:"service_count"`
}

key: frontierID; value: Frontier

type FrontierQuery

type FrontierQuery struct {
	Cursor uint64
	Count  int64
}

type RDS

type RDS interface {
	HGetAll(ctx context.Context, key string) *redis.MapStringStringCmd
	HSet(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
	Get(ctx context.Context, key string) *redis.StringCmd
	MGet(ctx context.Context, keys ...string) *redis.SliceCmd
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	Del(ctx context.Context, keys ...string) *redis.IntCmd
	Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
	Keys(ctx context.Context, pattern string) *redis.StringSliceCmd
	Ping(ctx context.Context) *redis.StatusCmd
	Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd
	Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd
	Exists(ctx context.Context, keys ...string) *redis.IntCmd

	TxPipeline() redis.Pipeliner
	Close() error
}

type Service

type Service struct {
	Service    string `json:"service"`
	FrontierID string `json:"frontier_id"`
	Addr       string `json:"addr"`
	UpdateTime int64  `json:"update_time"`
}

key: serviceID; value: Service

type ServiceQuery

type ServiceQuery struct {
	Cursor uint64
	Count  int64
}

Jump to

Keyboard shortcuts

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