Table.Add is now Table.Create. Insesrt event is now Create event.

This commit is contained in:
Milos Gajdos
2019-07-10 17:46:22 +01:00
parent 86dfa82dfa
commit 8f5aed707e
5 changed files with 24 additions and 43 deletions

View File

@@ -2,7 +2,6 @@ package table
import (
"errors"
"fmt"
"time"
)
@@ -15,28 +14,14 @@ var (
type EventType int
const (
// Insert is emitted when a new route has been inserted
Insert EventType = iota
// Create is emitted when a new route has been created
Create EventType = iota
// Delete is emitted when an existing route has been deleted
Delete
// Update is emitted when an existing route has been updated
Update
)
// String returns string representation of the event
func (et EventType) String() string {
switch et {
case Insert:
return "INSERT"
case Delete:
return "DELETE"
case Update:
return "UPDATE"
default:
return "UNKNOWN"
}
}
// Event is returned by a call to Next on the watcher.
type Event struct {
// Type defines type of event
@@ -47,11 +32,6 @@ type Event struct {
Route Route
}
// String prints human readable Event
func (e Event) String() string {
return fmt.Sprintf("[EVENT] time: %s type: %s", e.Timestamp, e.Type)
}
// WatchOption is used to define what routes to watch in the table
type WatchOption func(*WatchOptions)
@@ -88,7 +68,7 @@ type tableWatcher struct {
// Next returns the next noticed action taken on table
// TODO: this needs to be thought through properly;
// right now we only allow to watch destination
// right now we only allow to watch service
func (w *tableWatcher) Next() (*Event, error) {
for {
select {