thqcache

package module
v0.0.0-...-9276249 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteValue

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

ByteValue 缓存值的数据格式封装

func (ByteValue) ByteSlice

func (v ByteValue) ByteSlice() []byte

func (ByteValue) Len

func (v ByteValue) Len() int

func (ByteValue) String

func (v ByteValue) String() string

type Getter

type Getter interface {
	Get(key string) ([]byte, error)
}

type GetterFunc

type GetterFunc func(key string) ([]byte, error)

func (GetterFunc) Get

func (f GetterFunc) Get(key string) ([]byte, error)

type Group

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

Group 负责与外部交互控制主流程

func GetGroup

func GetGroup(name string) *Group

func NewGroup

func NewGroup(name string, maxBytes int64, getter Getter) *Group

func (*Group) Get

func (this *Group) Get(key string) (ByteValue, error)

func (*Group) RegisterPeers

func (this *Group) RegisterPeers(peers PeerPicker)

type HTTPPool

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

HTTPPool HTTP服务端

func NewHTTPPool

func NewHTTPPool(self string) *HTTPPool

func (*HTTPPool) Logf

func (this *HTTPPool) Logf(format string, v ...interface{})

func (*HTTPPool) PickPeer

func (this *HTTPPool) PickPeer(key string) (PeerGetter, bool)

func (*HTTPPool) ServeHTTP

func (this *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HTTPPool) Set

func (this *HTTPPool) Set(peers ...string)

type HttpGetter

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

HttpGetter 封装http获取缓存

func (HttpGetter) Get

func (h HttpGetter) Get(in *pb.Request, out *pb.Response) error

type PeerGetter

type PeerGetter interface {
	Get(in *proto.Request, out *proto.Response) error
}

PeerGetter 从节点获取数据

type PeerPicker

type PeerPicker interface {
	PickPeer(key string) (peer PeerGetter, ok bool)
}

PeerPicker 节点选择器

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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