p1

package
v0.0.0-...-3449da6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValueServer

type KeyValueServer interface {

	// Start starts the server on a distinct port, instantiates the database
	// and begins listening for incoming client connections. Start returns an
	// error if there was a problem listening on the specified port.
	//
	// This method should NOT block. Instead, it should spawn one or more
	// goroutines (to handle things like accepting incoming client connections,
	// broadcasting messages to clients, synchronizing access to the server's
	// set of connected clients, etc.) and then return.
	//
	// This method should return an error if the server has already been closed.
	Start(port int) error

	// Count returns the number of clients currently connected to the server.
	// This method must not be called on an un-started or closed server.
	Count() int

	// Close shuts down the server. All client connections should be closed immediately
	// and any goroutines running in the background should be signaled to return.
	Close()
}

KeyValueServer implements a simple centralized key value database server.

func New

func New() KeyValueServer

New creates and returns (but does not start) a new KeyValueServer.

Jump to

Keyboard shortcuts

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