()
| 25 | } |
| 26 | |
| 27 | func (this *KVDB) Init() error { |
| 28 | store, err := kvstore.DefaultStore() |
| 29 | if err != nil { |
| 30 | return err |
| 31 | } |
| 32 | |
| 33 | db, err := store.NewDB("agents") |
| 34 | if err != nil { |
| 35 | return err |
| 36 | } |
| 37 | |
| 38 | { |
| 39 | this.encoder = &AgentIPEncoder[*AgentIP]{} |
| 40 | table, tableErr := kvstore.NewTable[*AgentIP]("agent_ips", this.encoder) |
| 41 | if tableErr != nil { |
| 42 | return tableErr |
| 43 | } |
| 44 | db.AddTable(table) |
| 45 | this.table = table |
| 46 | } |
| 47 | |
| 48 | return nil |
| 49 | } |
| 50 | |
| 51 | func (this *KVDB) InsertAgentIP(ipId int64, ip string, agentCode string) error { |
| 52 | if this.table == nil { |
nothing calls this directly
no test coverage detected