-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (35 loc) · 774 Bytes
/
main.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
41
42
43
44
45
package main
import (
"flag"
"fmt"
"plugin"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
)
var pluginPath string
func init() {
flag.StringVar(&pluginPath, "plugin-path", "", "path to durability policy plugin")
flag.Parse()
}
func main() {
if pluginPath == "" {
panic("must define -plugin-path")
}
fmt.Printf("plugin path: %s\n", pluginPath)
p, err := plugin.Open(pluginPath)
if err != nil {
panic(err)
}
fmt.Printf("plugin: %v\n", p)
crossCell, err := p.Lookup("DurabilityCrossCell")
if err != nil {
panic(err)
}
RegisterDurability("cross_cell", func() Durabler {
return crossCell.(Durabler)
})
dur, err := GetDurabilityPolicy("cross_cell")
if err != nil {
panic(err)
}
fmt.Println(PromotionRule(dur, &topodatapb.Tablet{}))
}