server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comms

type Comms struct {
	*connect.ProtoComms

	*pb.UnimplementedRemoteSyncServer
	*messages.UnimplementedGenericServer
	// contains filtered or unexported fields
}

Comms object bundles low-level connect.ProtoComms, and the endpoint Handler interface.

func StartRemoteSync

func StartRemoteSync(id *id.ID, localServer string, handler Handler,
	certPem, keyPem []byte) *Comms

StartRemoteSync starts a new RemoteSync server on the address:port specified by localServer and a callback interface for remote sync operations with given path to public and private key for TLS connection.

func (*Comms) GetLastModified

func (rc *Comms) GetLastModified(ctx context.Context, message *pb.RsReadRequest) (*pb.RsTimestampResponse, error)

GetLastModified returns the last time a resource was modified

func (*Comms) GetLastWrite

func (rc *Comms) GetLastWrite(ctx context.Context, message *pb.RsLastWriteRequest) (*pb.RsTimestampResponse, error)

GetLastWrite returns the last time this remote sync server was modified

func (*Comms) Login

Login to the server, receiving a token

func (*Comms) Read

func (rc *Comms) Read(ctx context.Context, message *pb.RsReadRequest) (*pb.RsReadResponse, error)

Read data from the server

func (*Comms) ReadDir

func (rc *Comms) ReadDir(ctx context.Context, message *pb.RsReadRequest) (*pb.RsReadDirResponse, error)

ReadDir reads a directory from the server

func (*Comms) Write

func (rc *Comms) Write(ctx context.Context, message *pb.RsWriteRequest) (*messages.Ack, error)

Write data to the server

type Handler

Handler describes the endpoint callbacks for remote sync.

type Implementation

type Implementation struct {
	Functions implementationFunctions
}

Implementation allows users of the client library to set the functions that implement the node functions.

func NewImplementation

func NewImplementation() *Implementation

NewImplementation creates and returns a new Handler interface for implementing endpoint callbacks.

func (*Implementation) GetLastModified

func (s *Implementation) GetLastModified(message *pb.RsReadRequest) (*pb.RsTimestampResponse, error)

func (*Implementation) GetLastWrite

func (s *Implementation) GetLastWrite(message *messages.Ack) (*pb.RsTimestampResponse, error)

func (*Implementation) Login

func (*Implementation) Read

func (s *Implementation) Read(message *pb.RsReadRequest) (*pb.RsReadResponse, error)

func (*Implementation) ReadDir

func (s *Implementation) ReadDir(message *pb.RsReadRequest) (*pb.RsReadDirResponse, error)

func (*Implementation) Write

func (s *Implementation) Write(message *pb.RsWriteRequest) (*messages.Ack, error)

Jump to

Keyboard shortcuts

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