rpc

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRead = iota
	TypeWrite
	TypeResponse
	TypeError
	TypeEOF
	TypeClose
	TypePing
	TypeUpdate
	TypeSync
	TypeUnmap
)
View Source
const (
	MagicVersion = uint16(0x1b03) // Jiva03
)

Variables

View Source
var (
	//ErrRWTimeout r/w operation timeout
	ErrRWTimeout   = errors.New("r/w timeout")
	ErrPingTimeout = errors.New("Ping timeout")
)

Functions

func SetRPCTimeout

func SetRPCTimeout()

SetRPCTimeout is used to custom timeouts for read and write

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client replica client

func NewClient

func NewClient(conn net.Conn, closeChan chan struct{}) *Client

NewClient replica client

func (*Client) Close

func (c *Client) Close() error

Close replica client

func (*Client) Ping

func (c *Client) Ping() error

Ping replica client

func (*Client) ReadAt

func (c *Client) ReadAt(buf []byte, offset int64) (int, error)

ReadAt replica client

func (*Client) SetError

func (c *Client) SetError(err error)

SetError replica client transport error

func (*Client) Sync

func (c *Client) Sync() (int, error)

Sync replica client

func (*Client) TargetID

func (c *Client) TargetID() string

TargetID operation target ID

func (*Client) Unmap

func (c *Client) Unmap(offset int64, length int64) (int, error)

func (*Client) WriteAt

func (c *Client) WriteAt(buf []byte, offset int64) (int, error)

WriteAt replica client

type Message

type Message struct {
	Complete chan struct{}

	MagicVersion uint16
	Seq          uint32
	Type         uint32
	Offset       int64
	Data         []byte
	Size         int64

	ID journal.OpID //Seq and ID can apparently be collapsed into one (ID)
	// contains filtered or unexported fields
}

type SampleOp

type SampleOp int

SampleOp operation

const (
	// OpNone unitialized operation
	OpNone SampleOp = iota
	// OpRead read from replica
	OpRead
	// OpWrite write to replica
	OpWrite
	// OpPing ping replica
	OpPing
	// OpUpdate update replica
	OpUpdate
	//OpSync sync replica
	OpSync
	//OpUnmap unmap replica
	OpUnmap
)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conn net.Conn, data types.DataProcessor) *Server

func (*Server) Handle

func (s *Server) Handle() error

func (*Server) SetMonitorChannel

func (s *Server) SetMonitorChannel(monitorChan chan struct{})

func (*Server) Stop

func (s *Server) Stop() error

type Wire

type Wire struct {
	WriteLock sync.Mutex
	ReadLock  sync.Mutex
	// contains filtered or unexported fields
}

func NewWire

func NewWire(conn net.Conn) *Wire

func (*Wire) Close

func (w *Wire) Close() error

func (*Wire) CloseRead

func (w *Wire) CloseRead() error

func (*Wire) CloseWrite

func (w *Wire) CloseWrite() error

func (*Wire) Read

func (w *Wire) Read() (*Message, error)

func (*Wire) Write

func (w *Wire) Write(msg *Message) error

Jump to

Keyboard shortcuts

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