func (ev *KubeStateChange) Direction() UpdateDirectionType {
	if ev.NewValue == nil {
		return Reverse
	}
	return Forward
}
Direction is forward.
package api
import (
	"fmt"
	"sort"
	"strings"
	"github.com/golang/protobuf/proto"
	"github.com/contiv/vpp/dbresources"
)
type KeyValuePairs map[string]proto.Message
type KubeStateData map[string]KeyValuePairs  
type DBResync struct {
	Local          bool  
	KubeState      KubeStateData
	ExternalConfig KeyValuePairs
}
func NewDBResync() *DBResync {
	return &DBResync{
		KubeState:      NewKubeStateData(),
		ExternalConfig: make(KeyValuePairs),
	}
}
func NewKubeStateData() KubeStateData {
	kubeStateData := make(KubeStateData)
	for _, resource := range dbresources.GetDBResources() {
		kubeStateData[resource.Keyword] = make(KeyValuePairs)
	}
	return kubeStateData
}
type withName interface {
	GetName() string
}
type withNamespace interface {
	GetNamespace() string
}
func (ev *DBResync) GetName() string {
	return "Database Resync"
}
func (ev *DBResync) String() string {
	str := ev.GetName()
	if ev.Local {
		str += " (Local DB)"
	} else {
		str += " (Remote DB)"
	}
	var resources []string
	for resource := range ev.KubeState {
		resources = append(resources, resource)
	}
	sort.Strings(resources)
	empty := true
	for _, resource := range resources {
		var (
			withColon     string
			resourceItems []string
		)
		data := ev.KubeState[resource]
		for key, value := range data {
			var valueStr string
			valWithName, hasName := value.(withName)
			valWithNamespace, hasNamespace := value.(withNamespace)
			if !hasName {
				valueStr = key
			}
			if hasName && !hasNamespace {
				valueStr = valWithName.GetName()
			}
			if hasName && hasNamespace {
				valueStr = valWithNamespace.GetNamespace() + "/" + valWithName.GetName()
			}
			resourceItems = append(resourceItems, valueStr)
		}
		if len(resourceItems) == 0 {
			continue
		}
		empty = false
		sort.Strings(resourceItems)
		str += fmt.Sprintf("\n* %dx %s%s",
			len(data), resource, withColon)
		for _, resourceItem := range resourceItems {
			str += "\n    - " + resourceItem
		}
	}
	var externalKeys []string
	for key := range ev.ExternalConfig {
		externalKeys = append(externalKeys, key)
	}
	sort.Strings(externalKeys)
	if len(externalKeys) > 0 {
		empty = false
		str += fmt.Sprintf("\n* %dx external config items: %s",
			len(externalKeys), strings.Join(externalKeys, ", "))
	}
	if empty {
		str += " - empty dataset"
	}
	return str
}
func (ev *DBResync) Method() EventMethodType {
	return FullResync
}
func (ev *DBResync) IsBlocking() bool {
	return false
}
func (ev *DBResync) Done(error) {
	return
}
type KubeStateChange struct {
	Key       string
	Resource  string
	PrevValue proto.Message  
	NewValue  proto.Message  
}
func (ev *KubeStateChange) GetName() string {
	return "Kubernetes State Change"
}
func (ev *KubeStateChange) String() string {
	return fmt.Sprintf("%s\n"+
		"* resource: %s\n"+
		"* key: %s\n"+
		"* prev-value: %s\n"+
		"* new-value: %s", ev.GetName(), ev.Resource, ev.Key,
		protoToString(ev.PrevValue), protoToString(ev.NewValue))
}
func (ev *KubeStateChange) Method() EventMethodType {
	return Update
}
func (ev *KubeStateChange) TransactionType() UpdateTransactionType {
	return BestEffort
}