Documentation ¶
Index ¶
- func DependsOn(k1, k2 string, deps map[string]KeySet, visited KeySet) bool
- func ErrorToString(err error) string
- func ProtoToString(msg proto.Message) string
- func RecordProtoMessage(msg proto.Message) proto.Message
- func TopologicalOrder(keys KeySet, deps map[string]KeySet, depFirst bool, handleCycle bool) (sorted []string)
- type KeySet
- type RecordedProtoMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtoToString ¶
ProtoToString converts proto message to string.
func RecordProtoMessage ¶
RecordProtoMessage prepares proto message for recording and potential access via REST API. Note: no need to clone the message - once un-marshalled, the content is never changed (otherwise it would break prev-new value comparisons).
Types ¶
type KeySet ¶
type KeySet interface { // String return human-readable string representation of the key-set. String() string // Iterate exposes the set of keys as slice which can be iterated through. // The returned slice should not be modified. Iterate() []string // Length returns the number of keys in the set. Length() int // Has returns true if the given key is in the set. Has(key string) bool // Add adds key into the set. Add(key string) (changed bool) // Del removes key from the set. Del(key string) (changed bool) // Subtract removes keys from this set which are also in <ks2>. Subtract(ks2 KeySet) (changed bool) // Intersect removes keys from this set which are not in <ks2>. Intersect(ks2 KeySet) (changed bool) // CopyOnWrite returns first a shallow copy of the key set, which gets // deep-copied when it is about to get modified. CopyOnWrite() KeySet }
KeySet defines API for a set of keys.
func NewMapBasedKeySet ¶
NewMapBasedKeySet returns KeySet implemented using map.
func NewSingletonKeySet ¶
NewSingletonKeySet returns KeySet implementation for at most one key.
func NewSliceBasedKeySet ¶
NewSliceBasedKeySet returns KeySet implemented using a slice with ordered keys.
type RecordedProtoMessage ¶
RecordedProtoMessage is a proto.Message suitable for recording and access via REST API.
func (*RecordedProtoMessage) MarshalJSON ¶
func (p *RecordedProtoMessage) MarshalJSON() ([]byte, error)
MarshalJSON marshalls proto message using the marshaller from jsonpb. The jsonpb package produces a different output than the standard "encoding/json" package, which does not operate correctly on protocol buffers.