Documentation ¶
Index ¶
- Constants
- type FileReader
- type Option
- type Server
- func (s *Server) CheckHeartbeat()
- func (s *Server) EndSession(event pulse.Event, reply *string)
- func (s *Server) FocusGained(event pulse.Event, reply *string)
- func (s *Server) HeartbeatCheck() func()
- func (s *Server) OpenFile(event pulse.Event, reply *string)
- func (s *Server) SendHeartbeat(event pulse.Event, reply *string)
- func (s *Server) Start(port string) error
Constants ¶
const (
HeartbeatTTL = time.Minute * 10
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileReader ¶
FileReader is a simple abstraction that defines a function for getting metadata from a file within a git repository.
type Option ¶
func WithFileReader ¶
func WithFileReader(reader FileReader) Option
WithFileReader sets the file reader used by the server.
func WithStorage ¶
func WithStorage(storage pulse.TemporaryStorage) Option
WithStorage sets the storage used by the server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CheckHeartbeat ¶
func (s *Server) CheckHeartbeat()
CheckHeartbeat is used to check if the session has been inactive for more than ten minutes. If that is the case, the session will be terminated and saved to disk.
func (*Server) EndSession ¶
EndSession should be called by the *VimLeave* autocommand.
func (*Server) FocusGained ¶
FocusGained is invoked by the FocusGained autocommand. It is used to set the editor that is currently active. Even though we might have multiple editors open at any given time, we'll only count time for one.
func (*Server) HeartbeatCheck ¶
func (s *Server) HeartbeatCheck() func()
HeartbeatCheck runs a heartbeat ticker that ensures that the current session is not idle for more than ten minutes.
func (*Server) SendHeartbeat ¶
SendHeartbeat can be called for events such as buffer writes and cursor moves. Its purpose is to notify the server that the current session remains active. The server ends the session if it doesn't receive a heartbeat for 10 minutes.