Documentation ¶
Overview ¶
Package daemon implements a service for mediating access to the data store, and its client.
Most RPCs exposed by the service correspond to the methods of Store in the store package and are not documented here.
Index ¶
- Constants
- Variables
- func Serve(sockpath, dbpath string)
- type AddCmdRequest
- type AddCmdResponse
- type AddDirRequest
- type AddDirResponse
- type Client
- func (c *Client) AddCmd(text string) (int, error)
- func (c *Client) AddDir(dir string, incFactor float64) error
- func (c *Client) Close() error
- func (c *Client) Cmd(seq int) (string, error)
- func (c *Client) Cmds(from, upto int) ([]string, error)
- func (c *Client) DelCmd(seq int) error
- func (c *Client) DelDir(dir string) error
- func (c *Client) DelSharedVar(name string) error
- func (c *Client) Dirs(blacklist map[string]struct{}) ([]storedefs.Dir, error)
- func (c *Client) NextCmd(from int, prefix string) (int, string, error)
- func (c *Client) NextCmdSeq() (int, error)
- func (c *Client) Pid() (int, error)
- func (c *Client) PrevCmd(upto int, prefix string) (int, string, error)
- func (c *Client) ResetConn() error
- func (c *Client) SetSharedVar(name, value string) error
- func (c *Client) SharedVar(name string) (string, error)
- func (c *Client) SockPath() string
- func (c *Client) Version() (int, error)
- type CmdRequest
- type CmdResponse
- type CmdsRequest
- type CmdsResponse
- type DelCmdRequest
- type DelCmdResponse
- type DelDirRequest
- type DelDirResponse
- type DelSharedVarRequest
- type DelSharedVarResponse
- type DirsRequest
- type DirsResponse
- type NextCmdRequest
- type NextCmdResponse
- type NextCmdSeqRequest
- type NextCmdSeqResponse
- type PidRequest
- type PidResponse
- type PrevCmdRequest
- type PrevCmdResponse
- type Service
- func (s *Service) AddCmd(req *AddCmdRequest, res *AddCmdResponse) error
- func (s *Service) AddDir(req *AddDirRequest, res *AddDirResponse) error
- func (s *Service) Cmd(req *CmdRequest, res *CmdResponse) error
- func (s *Service) Cmds(req *CmdsRequest, res *CmdsResponse) error
- func (s *Service) DelCmd(req *DelCmdRequest, res *DelCmdResponse) error
- func (s *Service) DelDir(req *DelDirRequest, res *DelDirResponse) error
- func (s *Service) DelSharedVar(req *DelSharedVarRequest, res *DelSharedVarResponse) error
- func (s *Service) Dirs(req *DirsRequest, res *DirsResponse) error
- func (s *Service) NextCmd(req *NextCmdRequest, res *NextCmdResponse) error
- func (s *Service) NextCmdSeq(req *NextCmdSeqRequest, res *NextCmdSeqResponse) error
- func (s *Service) Pid(req *PidRequest, res *PidResponse) error
- func (s *Service) PrevCmd(req *PrevCmdRequest, res *PrevCmdResponse) error
- func (s *Service) SetSharedVar(req *SetSharedVarRequest, res *SetSharedVarResponse) error
- func (s *Service) SharedVar(req *SharedVarRequest, res *SharedVarResponse) error
- func (s *Service) Version(req *VersionRequest, res *VersionResponse) error
- type SetSharedVarRequest
- type SetSharedVarResponse
- type SharedVarRequest
- type SharedVarResponse
- type VersionRequest
- type VersionResponse
Constants ¶
const ( // ServiceName is the name of the RPC service exposed by the daemon. ServiceName = "Daemon" // Version is the API version. It should be bumped any time the API changes. Version = -94 )
Variables ¶
var ( // ErrClientNotInitialized is returned when the Client is not initialized. ErrClientNotInitialized = errors.New("client not initialized") // ErrDaemonUnreachable is returned when the daemon cannot be reached after // several retries. ErrDaemonUnreachable = errors.New("daemon offline") )
Functions ¶
Types ¶
type AddCmdRequest ¶ added in v0.11.0
type AddCmdRequest struct {
Text string
}
type AddCmdResponse ¶ added in v0.11.0
type AddCmdResponse struct {
Seq int
}
type AddDirRequest ¶ added in v0.11.0
type AddDirResponse ¶ added in v0.11.0
type AddDirResponse struct{}
type Client ¶ added in v0.11.0
type Client struct {
// contains filtered or unexported fields
}
Client is a client to the Elvish daemon. A nil *Client is safe to use.
func NewClient ¶ added in v0.11.0
NewClient creates a new Client instance that talks to the socket. Connection creation is deferred to the first request.
func (*Client) Close ¶ added in v0.11.0
Close waits for all outstanding requests to finish and close the connection. If the client is nil, it does nothing and returns nil.
func (*Client) DelSharedVar ¶ added in v0.11.0
func (*Client) NextCmdSeq ¶ added in v0.11.0
func (*Client) ResetConn ¶ added in v0.11.0
ResetConn resets the current connection. A new connection will be established the next time a request is made. If the client is nil, it does nothing.
func (*Client) SetSharedVar ¶ added in v0.11.0
type CmdRequest ¶ added in v0.11.0
type CmdRequest struct {
Seq int
}
type CmdResponse ¶ added in v0.11.0
type CmdResponse struct {
Text string
}
type CmdsRequest ¶ added in v0.11.0
type CmdsResponse ¶ added in v0.11.0
type CmdsResponse struct {
Cmds []string
}
type DelCmdRequest ¶ added in v0.12.0
type DelCmdRequest struct {
Seq int
}
type DelCmdResponse ¶ added in v0.12.0
type DelCmdResponse struct { }
type DelDirRequest ¶ added in v0.12.0
type DelDirRequest struct {
Dir string
}
type DelDirResponse ¶ added in v0.12.0
type DelDirResponse struct{}
type DelSharedVarRequest ¶ added in v0.11.0
type DelSharedVarRequest struct {
}type DelSharedVarResponse ¶ added in v0.11.0
type DelSharedVarResponse struct{}
type DirsRequest ¶ added in v0.11.0
type DirsRequest struct {
Blacklist map[string]struct{}
}
type DirsResponse ¶ added in v0.11.0
type NextCmdRequest ¶ added in v0.11.0
type NextCmdResponse ¶ added in v0.11.0
type NextCmdSeqRequest ¶ added in v0.11.0
type NextCmdSeqRequest struct{}
type NextCmdSeqResponse ¶ added in v0.11.0
type NextCmdSeqResponse struct {
Seq int
}
type PidRequest ¶ added in v0.11.0
type PidRequest struct{}
type PidResponse ¶ added in v0.11.0
type PidResponse struct {
Pid int
}
type PrevCmdRequest ¶ added in v0.11.0
type PrevCmdResponse ¶ added in v0.11.0
type Service ¶ added in v0.11.0
type Service struct {
// contains filtered or unexported fields
}
Service provides the daemon RPC service. It is suitable as a service for net/rpc.
func (*Service) AddCmd ¶ added in v0.11.0
func (s *Service) AddCmd(req *AddCmdRequest, res *AddCmdResponse) error
func (*Service) AddDir ¶ added in v0.11.0
func (s *Service) AddDir(req *AddDirRequest, res *AddDirResponse) error
func (*Service) Cmd ¶ added in v0.11.0
func (s *Service) Cmd(req *CmdRequest, res *CmdResponse) error
func (*Service) Cmds ¶ added in v0.11.0
func (s *Service) Cmds(req *CmdsRequest, res *CmdsResponse) error
func (*Service) DelCmd ¶ added in v0.12.0
func (s *Service) DelCmd(req *DelCmdRequest, res *DelCmdResponse) error
func (*Service) DelDir ¶ added in v0.12.0
func (s *Service) DelDir(req *DelDirRequest, res *DelDirResponse) error
func (*Service) DelSharedVar ¶ added in v0.11.0
func (s *Service) DelSharedVar(req *DelSharedVarRequest, res *DelSharedVarResponse) error
func (*Service) Dirs ¶ added in v0.11.0
func (s *Service) Dirs(req *DirsRequest, res *DirsResponse) error
func (*Service) NextCmd ¶ added in v0.11.0
func (s *Service) NextCmd(req *NextCmdRequest, res *NextCmdResponse) error
func (*Service) NextCmdSeq ¶ added in v0.11.0
func (s *Service) NextCmdSeq(req *NextCmdSeqRequest, res *NextCmdSeqResponse) error
func (*Service) Pid ¶ added in v0.11.0
func (s *Service) Pid(req *PidRequest, res *PidResponse) error
Pid returns the process ID of the daemon.
func (*Service) PrevCmd ¶ added in v0.11.0
func (s *Service) PrevCmd(req *PrevCmdRequest, res *PrevCmdResponse) error
func (*Service) SetSharedVar ¶ added in v0.11.0
func (s *Service) SetSharedVar(req *SetSharedVarRequest, res *SetSharedVarResponse) error
func (*Service) SharedVar ¶ added in v0.11.0
func (s *Service) SharedVar(req *SharedVarRequest, res *SharedVarResponse) error
func (*Service) Version ¶ added in v0.11.0
func (s *Service) Version(req *VersionRequest, res *VersionResponse) error
Version returns the API version number.
type SetSharedVarRequest ¶ added in v0.11.0
type SetSharedVarRequest struct {}
type SetSharedVarResponse ¶ added in v0.11.0
type SetSharedVarResponse struct{}
type SharedVarRequest ¶ added in v0.11.0
type SharedVarRequest struct {
}type SharedVarResponse ¶ added in v0.11.0
type SharedVarResponse struct {
}type VersionRequest ¶ added in v0.11.0
type VersionRequest struct{}
type VersionResponse ¶ added in v0.11.0
type VersionResponse struct {
Version int
}