Documentation
¶
Index ¶
- Constants
- func Serve(kv speedmap.Store, addr string) error
- type Client
- type Server
- func (s *Server) Del(ctx context.Context, in *pb.DelRequest) (*pb.ClientReply, error)
- func (s *Server) Get(ctx context.Context, in *pb.GetRequest) (*pb.ClientReply, error)
- func (s *Server) Listen(addr string) error
- func (s *Server) Put(ctx context.Context, in *pb.PutRequest) (*pb.ClientReply, error)
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout for making client requests to the speedmap server
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a helper struct to connect to the speedmap server and make requests.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the KVServer interface and is essentially just a wrapper around a speedmap key/value Store. Note that the Server performs NO synchronization, it simply passes all requests from all clients to the speedmap. Because each request is handled in its own go routine, it is expected that the wrapped Store is thread-safe.
func (*Server) Del ¶
func (s *Server) Del(ctx context.Context, in *pb.DelRequest) (*pb.ClientReply, error)
Del handles a del request to the speedmap, relying on the speedmap for concurrent synchronization of accesses.
func (*Server) Get ¶
func (s *Server) Get(ctx context.Context, in *pb.GetRequest) (*pb.ClientReply, error)
Get handles a get request to the speedmap, relying on the speedmap for concurrent synchronization of accesses. Note that Get uses GetoOrCreate in the speedmap, storing nil as the default value; this means that this method will not return a not found error. This decision was made to more completely test the misframe implementation of the Store.
func (*Server) Listen ¶
Listen for gRPC requests on the specified address and serve each request in its own go routine. The server handlers access the speed map.
func (*Server) Put ¶
func (s *Server) Put(ctx context.Context, in *pb.PutRequest) (*pb.ClientReply, error)
Put handles a put request to the speedmap, relying on the speedmap for concurrent synchronization of accesses.