Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartRPCServer ¶
func StartRPCServer(store *db.ShardedInMemoryStore, port string, logger *logger.Logger)
StartRPCServer starts the RPC server.
Types ¶
type RPCRequest ¶
type RPCRequest struct { Key string `json:"key"` Value string `json:"value,omitempty"` TTL int64 `json:"ttl"` // TTL in seconds }
RPCRequest represents the structure of an RPC request.
type RPCResponse ¶
type RPCResponse struct { Success bool `json:"success"` Data string `json:"data,omitempty"` Error string `json:"error,omitempty"` }
RPCResponse represents the structure of an RPC response.
type RPCService ¶
type RPCService struct { Store *db.ShardedInMemoryStore Logger *logger.Logger }
RPCService provides the RPC methods for the InMemoryStore.
func (*RPCService) RPCDelete ¶
func (s *RPCService) RPCDelete(req *RPCRequest, resp *RPCResponse) error
RPCDelete removes a key-value pair from the store.
func (*RPCService) RPCGet ¶
func (s *RPCService) RPCGet(req *RPCRequest, resp *RPCResponse) error
RPCGet retrieves a value by key from the store.
func (*RPCService) RPCSet ¶
func (s *RPCService) RPCSet(req *RPCRequest, resp *RPCResponse) error
RPCSet sets a key-value pair in the store.
Click to show internal directories.
Click to hide internal directories.