rpc

package
v0.0.0-...-bc94fc3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package `rpc` exports methods to interface with an RPC server.

This separation allows RPC clients to not require importing the `server` package, which makes them a lot lighter.

The "Impl" variables are to be used by the server for the internal implementations of each RPC opeartion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddAuthArgs

type AddAuthArgs struct {
	Username string
	Password string
	Role     string
}

Arguments for the AddAuth operation.

type Implementation

type Implementation interface {
	AddAuth(args *AddAuthArgs, reply *int) error
	RmAuth(args *RmAuthArgs, reply *int) error
}

The interface RPC servers must implement.

type RmAuthArgs

type RmAuthArgs struct {
	Username string
}

Arguments for the RmAuth operation.

type Server

type Server struct {
	HTTP *http.Server
	// contains filtered or unexported fields
}

Wraps the HTTP server generated by the implementation.

func NewServer

func NewServer(impl Implementation, port int) (*Server, error)

Returns an HTTP server that serves RPC in the passed port. The "Impl" variables should be used to configure its operations before running the server. If there is an issue setting up the server, returns an error.

func (*Server) AddAuth

func (srv *Server) AddAuth(args *AddAuthArgs, reply *int) error

Adds an user to the auth table in the database.

func (*Server) RmAuth

func (srv *Server) RmAuth(args *RmAuthArgs, reply *int) error

Removes an user from the auth table in the database.

Jump to

Keyboard shortcuts

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