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 TopologicalOrder(keys KeySet, deps map[string]KeySet, depFirst bool, handleCycle bool) (sorted []string)
- type KeySet
- type ProtoWithName
- type RecordedProtoMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DependsOn ¶
DependsOn returns true if k1 depends on k2 based on dependencies from <deps>.
func ProtoToString ¶
ProtoToString converts proto message to string.
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
// Equals compares this set with <set2> for equality.
Equals(set2 KeySet) bool
// 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.
type ProtoWithName ¶
ProtoWithName is used to marshall proto message data alongside the proto message name.
type RecordedProtoMessage ¶
RecordedProtoMessage is a proto.Message suitable for recording and access via REST API.
func RecordProtoMessage ¶
func RecordProtoMessage(msg proto.Message) *RecordedProtoMessage
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).
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.
func (*RecordedProtoMessage) UnmarshalJSON ¶
func (p *RecordedProtoMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON un-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.
Source Files
¶
- conversions.go
- dependencies.go
- keyset.go
- record.go