server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package server provides an alpha-quality implementation of an OVSDB Server

It is designed only to be used for testing the functionality of the client library such that assertions can be made on the cache that backs the client's monitor or the server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	CreateDatabase(name string, model *ovsdb.DatabaseSchema) error
	Exists(name string) bool
	Transact(database string, operations []ovsdb.Operation) ([]ovsdb.OperationResult, ovsdb.TableUpdates)
	Select(database string, table string, where []ovsdb.Condition, columns []string) ovsdb.OperationResult
	Insert(database string, table string, uuidName string, row ovsdb.Row) (ovsdb.OperationResult, ovsdb.TableUpdates)
	Update(database, table string, where []ovsdb.Condition, row ovsdb.Row) (ovsdb.OperationResult, ovsdb.TableUpdates)
	Mutate(database, table string, where []ovsdb.Condition, mutations []ovsdb.Mutation) (ovsdb.OperationResult, ovsdb.TableUpdates)
	Delete(database, table string, where []ovsdb.Condition) (ovsdb.OperationResult, ovsdb.TableUpdates)
	Wait(database, table string, timeout int, conditions []ovsdb.Condition, columns []string, until string, rows []ovsdb.Row) ovsdb.OperationResult
	Commit(database, table string, durable bool) ovsdb.OperationResult
	Abort(database, table string) ovsdb.OperationResult
	Comment(database, table string, comment string) ovsdb.OperationResult
	Assert(database, table, lock string) ovsdb.OperationResult
}

Database abstracts database operations from ovsdb

func NewInMemoryDatabase

func NewInMemoryDatabase(models map[string]*model.DBModel) Database

type DatabaseModel

type DatabaseModel struct {
	Model  *model.DBModel
	Schema *ovsdb.DatabaseSchema
}

type OvsdbServer

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

OvsdbServer is an ovsdb server

func NewOvsdbServer

func NewOvsdbServer(db Database, models ...DatabaseModel) (*OvsdbServer, error)

NewOvsdbServer returns a new OvsdbServer

func (*OvsdbServer) Cancel

func (o *OvsdbServer) Cancel(client *rpc2.Client, args []interface{}, reply *[]interface{}) error

Cancel cancels the last transaction

func (*OvsdbServer) Close

func (o *OvsdbServer) Close()

Close closes the OvsdbServer

func (*OvsdbServer) Echo

func (o *OvsdbServer) Echo(client *rpc2.Client, args []interface{}, reply *[]interface{}) error

Echo tests the liveness of the connection

func (*OvsdbServer) GetSchema

func (o *OvsdbServer) GetSchema(client *rpc2.Client, args []interface{}, reply *ovsdb.DatabaseSchema,
) error

func (*OvsdbServer) ListDatabases

func (o *OvsdbServer) ListDatabases(client *rpc2.Client, args []interface{}, reply *[]string) error

ListDatabases lists the databases in the current system

func (*OvsdbServer) Lock

func (o *OvsdbServer) Lock(client *rpc2.Client, args []interface{}, reply *[]interface{}) error

Lock acquires a lock on a table for a the client

func (*OvsdbServer) Monitor

func (o *OvsdbServer) Monitor(client *rpc2.Client, args []json.RawMessage, reply *ovsdb.TableUpdates) error

Monitor monitors a given database table and provides updates to the client via an RPC callback

func (*OvsdbServer) MonitorCancel

func (o *OvsdbServer) MonitorCancel(client *rpc2.Client, args []interface{}, reply *[]interface{}) error

MonitorCancel cancels a monitor on a given table

func (*OvsdbServer) Ready

func (o *OvsdbServer) Ready() bool

Ready returns true if a server is ready to handle connections

func (*OvsdbServer) Serve

func (o *OvsdbServer) Serve(protocol string, path string) error

Serve starts the OVSDB server on the given path and protocol

func (*OvsdbServer) Steal

func (o *OvsdbServer) Steal(client *rpc2.Client, args []interface{}, reply *[]interface{}) error

Steal steals a lock for a client

func (*OvsdbServer) Transact

func (o *OvsdbServer) Transact(client *rpc2.Client, args []json.RawMessage, reply *[]ovsdb.OperationResult) error

Transact issues a new database transaction and returns the results

func (*OvsdbServer) Unlock

func (o *OvsdbServer) Unlock(client *rpc2.Client, args []interface{}, reply *[]interface{}) error

Unlock releases a lock for a client

Jump to

Keyboard shortcuts

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