cacheserver

package
v0.0.0-...-c07845e Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewShard

func NewShard(perShardMax uint32) *shard

func UniformModel

func UniformModel(index, size int) float64

func ZipfModel

func ZipfModel(index, size int) float64

Types

type Config

type Config struct {
	Bind      string
	Connect   string
	Limit     uint
	NumShards uint
	ACL       auth.ACL
}

func (*Config) AddFlags

func (cfg *Config) AddFlags(fs *flag.FlagSet)

func (*Config) Dial

func (cfg *Config) Dial() (client.Client, error)

func (*Config) Listen

func (cfg *Config) Listen() (net.Listener, error)

func (*Config) Validate

func (cfg *Config) Validate() error

type ModelFunc

type ModelFunc func(index, size int) float64

ModelFunc is a function that takes the size of a cache and the index of one element (0 = most hits, size-1 == least hits), and returns the expected number of hits as a ratio to the max number of hits.

∀x: ∀y: 0.0 ≤ f(x, y) ≤ 1.0
    ∀y:       f(0, y) = 1.0

type Server

type Server struct {
	ACL    auth.ACL
	Auther auth.Auther
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg Config) *Server

func (*Server) Close

func (srv *Server) Close() error

func (*Server) Get

func (srv *Server) Get(ctx context.Context, in *proto.GetRequest) (out *proto.GetReply, err error)

func (*Server) Put

func (srv *Server) Put(ctx context.Context, in *proto.PutRequest) (out *proto.PutReply, err error)

func (*Server) Remove

func (srv *Server) Remove(ctx context.Context, in *proto.RemoveRequest) (out *proto.RemoveReply, err error)

func (*Server) Stat

func (srv *Server) Stat(ctx context.Context, in *proto.StatRequest) (*proto.StatReply, error)

func (*Server) Walk

func (srv *Server) Walk(in *proto.WalkRequest, serverstream proto.CAS_WalkServer) error

Jump to

Keyboard shortcuts

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