forked from ovn-org/libovsdb
-
Notifications
You must be signed in to change notification settings - Fork 10
/
rpc.go
40 lines (32 loc) · 1.23 KB
/
rpc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package libovsdb
// NewGetSchemaArgs creates a new set of arguments for a get_schemas RPC
func NewGetSchemaArgs(schema string) []interface{} {
return []interface{}{schema}
}
// NewTransactArgs creates a new set of arguments for a transact RPC
func NewTransactArgs(database string, operations ...Operation) []interface{} {
var dbSlice = make([]interface{}, 1)
dbSlice[0] = database
var opsSlice []interface{} = make([]interface{}, len(operations))
for i, d := range operations {
opsSlice[i] = d
}
ops := append(dbSlice, opsSlice...)
return ops
}
// NewCancelArgs creates a new set of arguments for a cancel RPC
func NewCancelArgs(id interface{}) []interface{} {
return []interface{}{id}
}
// NewMonitorArgs creates a new set of arguments for a monitor RPC
func NewMonitorArgs(database string, value interface{}, requests map[string]MonitorRequest) []interface{} {
return []interface{}{database, value, requests}
}
// NewMonitorCancelArgs creates a new set of arguments for a monitor_cancel RPC
func NewMonitorCancelArgs(value interface{}) []interface{} {
return []interface{}{value}
}
// NewLockArgs creates a new set of arguments for a lock, steal or unlock RPC
func NewLockArgs(id interface{}) []interface{} {
return []interface{}{id}
}