ovsdb

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 9 Imported by: 48

Documentation

Index

Constants

View Source
const (
	// OperationInsert is an insert operation
	OperationInsert = "insert"
	// OperationSelect is a select operation
	OperationSelect = "select"
	// OperationUpdate is an update operation
	OperationUpdate = "update"
	// OperationMutate is a mutate operation
	OperationMutate = "mutate"
	// OperationDelete is a delete operation
	OperationDelete = "delete"
	// OperationWait is a wait operation
	OperationWait = "wait"
	// OperationCommit is a commit operation
	OperationCommit = "commit"
	// OperationAbort is an abort operation
	OperationAbort = "abort"
	// OperationComment is a comment operation
	OperationComment = "comment"
	// OperationAssert is an assert operation
	OperationAssert = "assert"
)
View Source
const (

	//Strong RefType
	Strong RefType = "strong"
	//Weak RefType
	Weak RefType = "weak"

	//TypeInteger is equivalent to 'int'
	TypeInteger ExtendedType = "integer"
	//TypeReal is equivalent to 'float64'
	TypeReal ExtendedType = "real"
	//TypeBoolean is equivalent to 'bool'
	TypeBoolean ExtendedType = "boolean"
	//TypeString is equivalent to 'string'
	TypeString ExtendedType = "string"
	//TypeUUID is equivalent to 'libovsdb.UUID'
	TypeUUID ExtendedType = "uuid"

	//TypeEnum is an enumerator of type defined by Key.Type
	TypeEnum ExtendedType = "enum"
	//TypeMap is a map whose type depend on Key.Type and Value.Type
	TypeMap ExtendedType = "map"
	//TypeSet is a set whose type depend on Key.Type
	TypeSet ExtendedType = "set"
)

Variables

View Source
var UUIDColumn = ColumnSchema{
	Type: TypeUUID,
}

UUIDColumn is a static column that represents the _uuid column, common to all tables

View Source
var (
	// Unlimited is used to express unlimited "Max"
	Unlimited = -1
)

unlimited is not constant as we can't take the address of int constants

Functions

func IsDefaultValue

func IsDefaultValue(column *ColumnSchema, nativeElem interface{}) bool

IsDefaultValue checks if a provided native element corresponds to the default value of its designated column type

func NativeToOvs

func NativeToOvs(column *ColumnSchema, rawElem interface{}) (interface{}, error)

NativeToOvs transforms an native type to a ovs type based on the column type information

func NativeToOvsAtomic added in v0.6.0

func NativeToOvsAtomic(basicType string, nativeElem interface{}) (interface{}, error)

NativeToOvsAtomic returns the OVS type of the atomic native value

func NativeType

func NativeType(column *ColumnSchema) reflect.Type

NativeType returns the reflect.Type that can hold the value of a column OVS Type to Native Type convertions: OVS sets -> go slices OVS uuid -> go strings OVS map -> go map OVS enum -> go native type depending on the type of the enum key

func NativeTypeFromAtomic

func NativeTypeFromAtomic(basicType string) reflect.Type

NativeTypeFromAtomic returns the native type that can hold a value of an AtomicType

func NewCancelArgs

func NewCancelArgs(id interface{}) []interface{}

NewCancelArgs creates a new set of arguments for a cancel RPC

func NewEchoArgs added in v0.4.0

func NewEchoArgs() []interface{}

NewEchoArgs creates a new set of arguments for an echo RPC

func NewErrWrongType

func NewErrWrongType(from, expected string, got interface{}) error

NewErrWrongType creates a new ErrWrongType

func NewGetSchemaArgs

func NewGetSchemaArgs(schema string) []interface{}

NewGetSchemaArgs creates a new set of arguments for a get_schemas RPC

func NewLockArgs

func NewLockArgs(id interface{}) []interface{}

NewLockArgs creates a new set of arguments for a lock, steal or unlock RPC

func NewMonitorArgs

func NewMonitorArgs(database string, value interface{}, requests map[string]MonitorRequest) []interface{}

NewMonitorArgs creates a new set of arguments for a monitor RPC

func NewMonitorCancelArgs

func NewMonitorCancelArgs(value interface{}) []interface{}

NewMonitorCancelArgs creates a new set of arguments for a monitor_cancel RPC

func NewTransactArgs

func NewTransactArgs(database string, operations ...Operation) []interface{}

NewTransactArgs creates a new set of arguments for a transact RPC

func OvsToNative

func OvsToNative(column *ColumnSchema, ovsElem interface{}) (interface{}, error)

OvsToNative transforms an ovs type to native one based on the column type information

func OvsToNativeAtomic

func OvsToNativeAtomic(basicType string, ovsElem interface{}) (interface{}, error)

OvsToNativeAtomic returns the native type of the basic ovs type

func ValidateCondition added in v0.4.0

func ValidateCondition(column *ColumnSchema, function ConditionFunction, nativeValue interface{}) error

func ValidateMutation

func ValidateMutation(column *ColumnSchema, mutator Mutator, value interface{}) error

ValidateMutation checks if the mutation value and mutator string area appropriate for a given column based on the rules specified RFC7047

Types

type Aborted added in v0.4.0

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

Aborted is described in RFC 7047: 5.2.8

func (*Aborted) Error added in v0.4.0

func (e *Aborted) Error() string

Error implements the error interface

func (*Aborted) Operation added in v0.4.0

func (e *Aborted) Operation() *Operation

Operation implements the OperationError interface

type BaseType

type BaseType struct {
	Type string
	Enum []interface{}
	// contains filtered or unexported fields
}

BaseType is a base-type structure as per RFC7047

func (BaseType) MarshalJSON added in v0.4.0

func (b BaseType) MarshalJSON() ([]byte, error)

MarshalJSON marshals a base type to JSON

func (*BaseType) MaxInteger

func (b *BaseType) MaxInteger() (int, error)

MaxInteger returns the minimum integer value RFC7047 specifies the minimum to be 2^63-1

func (*BaseType) MaxLength

func (b *BaseType) MaxLength() (int, error)

MaxLength returns the maximum string length RFC7047 doesn't specify a default, but we assume that it must 2^63-1

func (*BaseType) MaxReal

func (b *BaseType) MaxReal() (float64, error)

MaxReal returns the maximum real value RFC7047 does not define a default, but this would be the maximum value held by a float64

func (*BaseType) MinInteger

func (b *BaseType) MinInteger() (int, error)

MinInteger returns the minimum integer value RFC7047 specifies the minimum to be -2^63

func (*BaseType) MinLength

func (b *BaseType) MinLength() (int, error)

MinLength returns the minimum string length RFC7047 doesn't specify a default, but we assume that it must be >= 0

func (*BaseType) MinReal

func (b *BaseType) MinReal() (float64, error)

MinReal returns the minimum real value RFC7047 does not define a default, but we assume this to be the smallest non zero value a float64 could hold

func (*BaseType) RefTable

func (b *BaseType) RefTable() (string, error)

RefTable returns the table to which a UUID type refers It will return an empty string if not set

func (*BaseType) RefType

func (b *BaseType) RefType() (RefType, error)

RefType returns the reference type for a UUID field RFC7047 infers the RefType is strong if omitted

func (*BaseType) UnmarshalJSON added in v0.4.0

func (b *BaseType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a json-formatted base type

type ColumnSchema

type ColumnSchema struct {
	// According to RFC7047, "type" field can be, either an <atomic-type>
	// Or a ColumnType defined below. To try to simplify the usage, the
	// json message will be parsed manually and Type will indicate the "extended"
	// type. Depending on its value, more information may be available in TypeObj.
	// E.g: If Type == TypeEnum, TypeObj.Key.Enum contains the possible values
	Type    ExtendedType
	TypeObj *ColumnType
	// contains filtered or unexported fields
}

ColumnSchema is a column schema according to RFC7047

func (*ColumnSchema) Ephemeral

func (c *ColumnSchema) Ephemeral() bool

Ephemeral returns whether a column is ephemeral

func (ColumnSchema) MarshalJSON added in v0.4.0

func (c ColumnSchema) MarshalJSON() ([]byte, error)

MarshalJSON marshalls a column schema to JSON

func (*ColumnSchema) Mutable

func (c *ColumnSchema) Mutable() bool

Mutable returns whether a column is mutable

func (*ColumnSchema) String

func (c *ColumnSchema) String() string

String returns a string representation of the (native) column type

func (*ColumnSchema) UnmarshalJSON

func (c *ColumnSchema) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshalls a json-formatted column

type ColumnType

type ColumnType struct {
	Key   *BaseType
	Value *BaseType
	// contains filtered or unexported fields
}

ColumnType is a type object as per RFC7047 "key": <base-type> required "value": <base-type> optional "min": <integer> optional (default: 1) "max": <integer> or "unlimited" optional (default: 1)

func (ColumnType) MarshalJSON added in v0.4.0

func (c ColumnType) MarshalJSON() ([]byte, error)

MarshalJSON marshalls a column type to JSON

func (*ColumnType) Max

func (c *ColumnType) Max() int

Max returns the maximum value of a ColumnType. -1 is Unlimited

func (*ColumnType) Min

func (c *ColumnType) Min() int

Min returns the minimum value of a ColumnType

func (*ColumnType) UnmarshalJSON added in v0.4.0

func (c *ColumnType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a json-formatted column type

type Condition added in v0.4.0

type Condition struct {
	Column   string
	Function ConditionFunction
	Value    interface{}
}

Condition is described in RFC 7047: 5.1

func NewCondition

func NewCondition(column string, function ConditionFunction, value interface{}) Condition

NewCondition returns a new condition

func (Condition) MarshalJSON added in v0.4.0

func (c Condition) MarshalJSON() ([]byte, error)

MarshalJSON marshals a condition to a 3 element JSON array

func (Condition) String added in v0.4.0

func (c Condition) String() string

func (*Condition) UnmarshalJSON added in v0.4.0

func (c *Condition) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a 3 element JSON array to a Condition

type ConditionFunction added in v0.4.0

type ConditionFunction string
const (
	// ConditionLessThan is the less than condition
	ConditionLessThan ConditionFunction = "<"
	// ConditionLessThanOrEqual is the less than or equal condition
	ConditionLessThanOrEqual ConditionFunction = "<="
	// ConditionEqual is the equal condition
	ConditionEqual ConditionFunction = "=="
	// ConditionNotEqual is the not equal condition
	ConditionNotEqual ConditionFunction = "!="
	// ConditionGreaterThan is the greater than condition
	ConditionGreaterThan ConditionFunction = ">"
	// ConditionGreaterThanOrEqual is the greater than or equal condition
	ConditionGreaterThanOrEqual ConditionFunction = ">="
	// ConditionIncludes is the includes condition
	ConditionIncludes ConditionFunction = "includes"
	// ConditionExcludes is the excludes condition
	ConditionExcludes ConditionFunction = "excludes"
)

func (ConditionFunction) Evaluate added in v0.4.0

func (c ConditionFunction) Evaluate(a interface{}, b interface{}) (bool, error)

Evaluate will evaluate the condition on the two provided values The conditions operately differently depending on the type of the provided values. The behavjour is as described in RFC7047

type ConstraintViolation added in v0.4.0

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

ConstraintViolation is described in RFC 7047: 4.1.3

func (*ConstraintViolation) Error added in v0.4.0

func (e *ConstraintViolation) Error() string

Error implements the error interface

func (*ConstraintViolation) Operation added in v0.4.0

func (e *ConstraintViolation) Operation() *Operation

Operation implements the OperationError interface

type DatabaseSchema

type DatabaseSchema struct {
	Name    string                 `json:"name"`
	Version string                 `json:"version"`
	Tables  map[string]TableSchema `json:"tables"`
}

DatabaseSchema is a database schema according to RFC7047

func SchemaFromFile added in v0.4.0

func SchemaFromFile(f *os.File) (*DatabaseSchema, error)

SchemaFromFile returns a DatabaseSchema from a file

func (DatabaseSchema) Print

func (schema DatabaseSchema) Print(w io.Writer)

Print will print the contents of the DatabaseSchema

func (DatabaseSchema) Table

func (schema DatabaseSchema) Table(tableName string) *TableSchema

Table returns a TableSchema Schema for a given table and column name

func (DatabaseSchema) ValidateOperations

func (schema DatabaseSchema) ValidateOperations(operations ...Operation) bool

ValidateOperations performs basic validation for operations against a DatabaseSchema

type DomainError added in v0.4.0

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

DomainError is described in RFC 7047: 5.2.4

func (*DomainError) Error added in v0.4.0

func (e *DomainError) Error() string

Error implements the error interface

func (*DomainError) Operation added in v0.4.0

func (e *DomainError) Operation() *Operation

Operation implements the OperationError interface

type DuplicateUUIDName added in v0.4.0

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

DuplicateUUIDName is described in RFC7047 5.2.1

func (*DuplicateUUIDName) Error added in v0.4.0

func (e *DuplicateUUIDName) Error() string

Error implements the error interface

func (*DuplicateUUIDName) Operation added in v0.4.0

func (e *DuplicateUUIDName) Operation() *Operation

Operation implements the OperationError interface

type ErrWrongType

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

ErrWrongType describes typing error

func (*ErrWrongType) Error

func (e *ErrWrongType) Error() string

type Error added in v0.4.0

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

Error is a generic OVSDB Error type that implements the OperationError and error interfaces

func (*Error) Error added in v0.4.0

func (e *Error) Error() string

Error implements the error interface

func (*Error) Operation added in v0.4.0

func (e *Error) Operation() *Operation

Operation implements the OperationError interface

type ExtendedType

type ExtendedType = string

ExtendedType includes atomic types as defined in the RFC plus Enum, Map and Set

type IOError added in v0.4.0

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

IOError is described in RFC7047: 4.1.3

func (*IOError) Error added in v0.4.0

func (e *IOError) Error() string

Error implements the error interface

func (*IOError) Operation added in v0.4.0

func (e *IOError) Operation() *Operation

Operation implements the OperationError interface

type MonitorRequest

type MonitorRequest struct {
	Columns []string       `json:"columns,omitempty"`
	Select  *MonitorSelect `json:"select,omitempty"`
}

MonitorRequest represents a monitor request according to RFC7047

type MonitorRequests

type MonitorRequests struct {
	Requests map[string]MonitorRequest `json:"requests"`
}

MonitorRequests represents a group of monitor requests according to RFC7047 We cannot use MonitorRequests by inlining the MonitorRequest Map structure till GoLang issue #6213 makes it. The only option is to go with raw map[string]interface{} option :-( that sucks ! Refer to client.go : MonitorAll() function for more details

type MonitorSelect

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

MonitorSelect represents a monitor select according to RFC7047

func NewDefaultMonitorSelect added in v0.4.0

func NewDefaultMonitorSelect() *MonitorSelect

NewDefaultMonitorSelect returns a new MonitorSelect with default values

func NewMonitorSelect added in v0.4.0

func NewMonitorSelect(initial, insert, delete, modify bool) *MonitorSelect

NewMonitorSelect returns a new MonitorSelect with the provided values

func (MonitorSelect) Delete

func (m MonitorSelect) Delete() bool

Delete returns whether we will receive updates for deletions

func (MonitorSelect) Initial

func (m MonitorSelect) Initial() bool

Initial returns whether or not an initial response will be sent

func (MonitorSelect) Insert

func (m MonitorSelect) Insert() bool

Insert returns whether we will receive updates for inserts

func (MonitorSelect) MarshalJSON added in v0.4.0

func (m MonitorSelect) MarshalJSON() ([]byte, error)

func (MonitorSelect) Modify

func (m MonitorSelect) Modify() bool

Modify returns whether we will receive updates for modifications

func (*MonitorSelect) UnmarshalJSON added in v0.4.0

func (m *MonitorSelect) UnmarshalJSON(data []byte) error

type Mutation added in v0.4.0

type Mutation struct {
	Column  string
	Mutator Mutator
	Value   interface{}
}

Mutation is described in RFC 7047: 5.1

func NewMutation

func NewMutation(column string, mutator Mutator, value interface{}) *Mutation

NewMutation returns a new mutation

func (Mutation) MarshalJSON added in v0.4.0

func (m Mutation) MarshalJSON() ([]byte, error)

MarshalJSON marshals a mutation to a 3 element JSON array

func (*Mutation) UnmarshalJSON added in v0.4.0

func (m *Mutation) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a 3 element JSON array to a Mutation

type Mutator

type Mutator string
const (
	// MutateOperationDelete is the delete mutator
	MutateOperationDelete Mutator = "delete"
	// MutateOperationInsert is the insert mutator
	MutateOperationInsert Mutator = "insert"
	// MutateOperationAdd is the add mutator
	MutateOperationAdd Mutator = "+="
	// MutateOperationSubtract is the subtract mutator
	MutateOperationSubtract Mutator = "-="
	// MutateOperationMultiply is the multiply mutator
	MutateOperationMultiply Mutator = "*="
	// MutateOperationDivide is the divide mutator
	MutateOperationDivide Mutator = "/="
	// MutateOperationModulo is the modulo mutator
	MutateOperationModulo Mutator = "%="
)

type NotOwner added in v0.4.0

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

NotOwner is described in RFC 7047: 5.2.9

func (*NotOwner) Error added in v0.4.0

func (e *NotOwner) Error() string

Error implements the error interface

func (*NotOwner) Operation added in v0.4.0

func (e *NotOwner) Operation() *Operation

Operation implements the OperationError interface

type NotSupported added in v0.4.0

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

NotSupported is described in RFC 7047: 5.2.7

func (*NotSupported) Error added in v0.4.0

func (e *NotSupported) Error() string

Error implements the error interface

func (*NotSupported) Operation added in v0.4.0

func (e *NotSupported) Operation() *Operation

Operation implements the OperationError interface

type NotificationHandler

type NotificationHandler interface {
	// RFC 7047 section 4.1.6 Update Notification
	Update(context interface{}, tableUpdates TableUpdates)

	// RFC 7047 section 4.1.9 Locked Notification
	Locked([]interface{})

	// RFC 7047 section 4.1.10 Stolen Notification
	Stolen([]interface{})

	// RFC 7047 section 4.1.11 Echo Notification
	Echo([]interface{})

	Disconnected()
}

NotificationHandler is the interface that must be implemented to receive notifcations

type Operation

type Operation struct {
	Op        string      `json:"op"`
	Table     string      `json:"table"`
	Row       Row         `json:"row,omitempty"`
	Rows      []Row       `json:"rows,omitempty"`
	Columns   []string    `json:"columns,omitempty"`
	Mutations []Mutation  `json:"mutations,omitempty"`
	Timeout   int         `json:"timeout,omitempty"`
	Where     []Condition `json:"where,omitempty"`
	Until     string      `json:"until,omitempty"`
	Durable   *bool       `json:"durable,omitempty"`
	Comment   *string     `json:"comment,omitempty"`
	Lock      *string     `json:"lock,omitempty"`
	UUIDName  string      `json:"uuid-name,omitempty"`
}

Operation represents an operation according to RFC7047 section 5.2

func (Operation) MarshalJSON

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON marshalls 'Operation' to a byte array For 'select' operations, we don't omit the 'Where' field to allow selecting all rows of a table

type OperationError added in v0.4.0

type OperationError interface {
	error
	// Operation is a pointer to the operation which caused the error
	Operation() *Operation
}

OperationError represents an error that occurred as part of an OVSDB Operation

func CheckOperationResults added in v0.4.0

func CheckOperationResults(result []OperationResult, ops []Operation) ([]OperationError, error)

CheckOperationResults checks whether the provided operation was a success If the operation was a success, it will return nil, nil If the operation failed, due to a error committing the transaction it will return nil, error. Finally, in the case where one or more of the operations in the transaction failed, we return []OperationErrors, error Within []OperationErrors, the OperationErrors.Index() corresponds to the same index in the original Operations struct. You may also perform type assertions against the error so the caller can decide how best to handle it

type OperationResult

type OperationResult struct {
	Count   int    `json:"count,omitempty"`
	Error   string `json:"error,omitempty"`
	Details string `json:"details,omitempty"`
	UUID    UUID   `json:"uuid,omitempty"`
	Rows    []Row  `json:"rows,omitempty"`
}

OperationResult is the result of an Operation

type OvsMap

type OvsMap struct {
	GoMap map[interface{}]interface{}
}

OvsMap is the JSON map structure used for OVSDB RFC 7047 uses the following notation for map as JSON doesnt support non-string keys for maps. A 2-element JSON array that represents a database map value. The first element of the array must be the string "map", and the second element must be an array of zero or more <pair>s giving the values in the map. All of the <pair>s must have the same key and value types.

func NewOvsMap

func NewOvsMap(goMap interface{}) (OvsMap, error)

NewOvsMap will return an OVSDB style map from a provided Golang Map

func (OvsMap) MarshalJSON

func (o OvsMap) MarshalJSON() ([]byte, error)

MarshalJSON marshalls an OVSDB style Map to a byte array

func (*OvsMap) UnmarshalJSON

func (o *OvsMap) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshalls an OVSDB style Map from a byte array

type OvsSet

type OvsSet struct {
	GoSet []interface{}
}

OvsSet is an OVSDB style set RFC 7047 has a weird (but understandable) notation for set as described as : Either an <atom>, representing a set with exactly one element, or a 2-element JSON array that represents a database set value. The first element of the array must be the string "set", and the second element must be an array of zero or more <atom>s giving the values in the set. All of the <atom>s must have the same type.

func NewOvsSet

func NewOvsSet(obj interface{}) (OvsSet, error)

NewOvsSet creates a new OVSDB style set from a Go interface (object)

func (OvsSet) MarshalJSON

func (o OvsSet) MarshalJSON() ([]byte, error)

MarshalJSON wil marshal an OVSDB style Set in to a JSON byte array

func (*OvsSet) UnmarshalJSON

func (o *OvsSet) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON will unmarshal a JSON byte array to an OVSDB style Set

type RangeError added in v0.4.0

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

RangeError is described in RFC 7047: 5.2.4

func (*RangeError) Error added in v0.4.0

func (e *RangeError) Error() string

Error implements the error interface

func (*RangeError) Operation added in v0.4.0

func (e *RangeError) Operation() *Operation

Operation implements the OperationError interface

type RefType

type RefType = string

RefType is used to define the possible RefTypes

type ReferentialIntegrityViolation added in v0.4.0

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

ReferentialIntegrityViolation is explained in RFC 7047 4.1.3

func (*ReferentialIntegrityViolation) Error added in v0.4.0

Error implements the error interface

func (*ReferentialIntegrityViolation) Operation added in v0.4.0

func (e *ReferentialIntegrityViolation) Operation() *Operation

Operation implements the OperationError interface

type ResourcesExhausted added in v0.4.0

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

ResourcesExhausted is described in RFC 7047: 4.1.3

func (*ResourcesExhausted) Error added in v0.4.0

func (e *ResourcesExhausted) Error() string

Error implements the error interface

func (*ResourcesExhausted) Operation added in v0.4.0

func (e *ResourcesExhausted) Operation() *Operation

Operation implements the OperationError interface

type Row

type Row map[string]interface{}

Row is a table Row according to RFC7047

func NewRow added in v0.4.0

func NewRow() Row

NewRow returns a new empty row

func (*Row) UnmarshalJSON

func (r *Row) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshalls a byte array to an OVSDB Row

type RowUpdate

type RowUpdate struct {
	New *Row `json:"new,omitempty"`
	Old *Row `json:"old,omitempty"`
}

RowUpdate represents a row update according to RFC7047

func (RowUpdate) Delete added in v0.4.0

func (r RowUpdate) Delete() bool

Delete returns true if this is an update for a delete operation

func (RowUpdate) Insert added in v0.4.0

func (r RowUpdate) Insert() bool

Insert returns true if this is an update for an insert operation

func (*RowUpdate) Merge added in v0.4.0

func (r *RowUpdate) Merge(new *RowUpdate)

func (RowUpdate) Modify added in v0.4.0

func (r RowUpdate) Modify() bool

Modify returns true if this is an update for a modify operation

type TableSchema

type TableSchema struct {
	Columns map[string]*ColumnSchema `json:"columns"`
	Indexes [][]string               `json:"indexes,omitempty"`
}

TableSchema is a table schema according to RFC7047

func (TableSchema) Column

func (t TableSchema) Column(columnName string) *ColumnSchema

Column returns the Column object for a specific column name

type TableUpdate

type TableUpdate map[string]*RowUpdate

TableUpdate is an object that maps from the row's UUID to a RowUpdate

func (TableUpdate) AddRowUpdate added in v0.4.0

func (t TableUpdate) AddRowUpdate(uuid string, update *RowUpdate)

type TableUpdates

type TableUpdates map[string]TableUpdate

TableUpdates is an object that maps from a table name to a TableUpdate

func (TableUpdates) AddTableUpdate added in v0.4.0

func (t TableUpdates) AddTableUpdate(table string, update TableUpdate)

AddTableUpdate adds a new TableUpdate to a TableUpdates

func (TableUpdates) Merge added in v0.4.0

func (t TableUpdates) Merge(update TableUpdates)

type TimedOut added in v0.4.0

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

TimedOut is described in RFC 7047: 5.2.6

func (*TimedOut) Error added in v0.4.0

func (e *TimedOut) Error() string

Error implements the error interface

func (*TimedOut) Operation added in v0.4.0

func (e *TimedOut) Operation() *Operation

Operation implements the OperationError interface

type TransactResponse

type TransactResponse struct {
	Result []OperationResult `json:"result"`
	Error  string            `json:"error"`
}

TransactResponse represents the response to a Transact Operation

type UUID

type UUID struct {
	GoUUID string `json:"uuid"`
}

UUID is a UUID according to RFC7047

func (UUID) MarshalJSON

func (u UUID) MarshalJSON() ([]byte, error)

MarshalJSON will marshal an OVSDB style UUID to a JSON encoded byte array

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON will unmarshal a JSON encoded byte array to a OVSDB style UUID

Jump to

Keyboard shortcuts

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