netgraph

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Separator separates key:value pairs in string representation of options.
	Separator = "/"

	// NodesBucket is the name for optionless bucket containing only nodes.
	NodesBucket = "Node"
)

Variables

View Source
var (
	ErrInvalidLengthSelector = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSelector   = fmt.Errorf("proto: integer overflow")
)
View Source
var Operation_name = map[int32]string{
	0: "NP",
	1: "EQ",
	2: "NE",
	3: "GT",
	4: "GE",
	5: "LT",
	6: "LE",
	7: "OR",
	8: "AND",
}
View Source
var Operation_value = map[string]int32{
	"NP":  0,
	"EQ":  1,
	"NE":  2,
	"GT":  3,
	"GE":  4,
	"LT":  5,
	"LE":  6,
	"OR":  7,
	"AND": 8,
}
View Source
var Type_name = map[int32]string{
	0: "String",
	1: "Integer",
}
View Source
var Type_value = map[string]int32{
	"String":  0,
	"Integer": 1,
}

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Key   string
	Value string
	// contains filtered or unexported fields
}

Bucket represents netmap as graph.

func (*Bucket) AddBucket

func (b *Bucket) AddBucket(o string, n []int32) error

AddBucket add bucket corresponding to option o with nodes n as subbucket to b.

func (*Bucket) AddChild

func (b *Bucket) AddChild(c Bucket)

AddChild adds c as direct child to b.

func (*Bucket) AddNode

func (b *Bucket) AddNode(n int32, opts ...string) error

AddNode adds node n with options opts to b.

func (Bucket) CheckConflicts

func (b Bucket) CheckConflicts(b1 Bucket) bool

CheckConflicts checks if b1 is ready to merge with b. Conflict is a situation, when node has different values for the same option in b and b1.

func (Bucket) Children

func (b Bucket) Children() []Bucket

Children returns array of subbuckets of b.

func (Bucket) Copy

func (b Bucket) Copy() Bucket

Copy returns deep copy of Bucket.

func (Bucket) Dump

func (b Bucket) Dump(name string) error

Dump dumps string representation of Bucket in *.dot format to file name.

func (Bucket) DumpWithSelection

func (b Bucket) DumpWithSelection(name string, b1 Bucket) error

DumpWithSelection dumps string representation of Bucket in *.dot format where subgraph b1 is highlighted to file name.

func (Bucket) Equals

func (b Bucket) Equals(b1 Bucket) bool

Equals checks if b and b1 represent the same Bucket (excluding contained nodes).

func (*Bucket) FindGraph

func (b *Bucket) FindGraph(pivot []byte, ss ...SFGroup) (c *Bucket)

FindGraph returns random subgraph, corresponding to specified placement rule.

func (*Bucket) FindNodes

func (b *Bucket) FindNodes(pivot []byte, ss ...SFGroup) (nodes []int32)

FindNodes returns list of nodes, corresponding to specified placement rule.

func (Bucket) GetMaxSelection

func (b Bucket) GetMaxSelection(ss []Select, fs []Filter) (r *Bucket)

GetMaxSelection returns 'maximal container' -- subgraph which contains any other subgraph satisfying specified selects and filters.

func (Bucket) GetNodesByOption

func (b Bucket) GetNodesByOption(opts ...string) []int32

GetNodesByOption returns list of nodes possessing specified options.

func (Bucket) GetSelection

func (b Bucket) GetSelection(ss []Select, pivot []byte) *Bucket

GetSelection returns subgraph, satisfying specified selections. It is assumed that all filters were already applied.

func (Bucket) Hash added in v1.0.4

func (b Bucket) Hash() uint64

Hash uses murmur3 hash to return uint64

func (Bucket) IsValid

func (b Bucket) IsValid() bool

IsValid checks if bucket is well-formed: - all nodes contained in sub-bucket must belong to this - there must be no nodes belonging to 2 buckets

func (Bucket) MarshalBinary

func (b Bucket) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*Bucket) Merge

func (b *Bucket) Merge(b1 Bucket)

Merge merges b1 into b assuming there are no conflicts.

func (Bucket) Name

func (b Bucket) Name() string

Name return b's short string identifier.

func (Bucket) Nodelist

func (b Bucket) Nodelist() (r []int32)

Nodelist returns slice of nodes belonging to b.

func (*Bucket) Read

func (b *Bucket) Read(r io.Reader) error

Read reads Bucket in serialized form: [lnName][Name][lnNodes][Node1]...[NodeN][lnSubprops][sub1]...[subN]

func (Bucket) Sdump

func (b Bucket) Sdump() (string, error)

Sdump returns string representation of Bucket in *.dot format.

func (Bucket) SdumpWithSelection

func (b Bucket) SdumpWithSelection(b1 Bucket) (string, error)

SdumpWithSelection returns string representation of Bucket in *.dot format where subgraph b1 is highlighted.

func (*Bucket) UnmarshalBinary

func (b *Bucket) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Bucket) UpdateIndices

func (b *Bucket) UpdateIndices(tr map[int32]int32) Bucket

UpdateIndices is auxiliary function used to update indices of all nodes according to tr.

func (Bucket) Write

func (b Bucket) Write(w io.Writer) error

Writes Bucket with this byte structure [lnName][Name][lnNodes][Node1]...[NodeN][lnSubprops][sub1]...[subN]

type Filter

type Filter struct {
	Key                  string        `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"`
	F                    *SimpleFilter `protobuf:"bytes,2,opt,name=F,proto3" json:"F,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (Filter) Check

func (f Filter) Check(b Bucket) bool

Check checks is Bucket satisfies filter f.

func (*Filter) Descriptor

func (*Filter) Descriptor() ([]byte, []int)

func (Filter) Filter

func (f Filter) Filter(bs ...Bucket) []Bucket

Filter returns sublist of bs, satisfying f.

func (*Filter) GetF

func (m *Filter) GetF() *SimpleFilter

func (*Filter) GetKey

func (m *Filter) GetKey() string

func (*Filter) Marshal

func (m *Filter) Marshal() (dAtA []byte, err error)

func (*Filter) MarshalTo

func (m *Filter) MarshalTo(dAtA []byte) (int, error)

func (*Filter) ProtoMessage

func (*Filter) ProtoMessage()

func (*Filter) Reset

func (m *Filter) Reset()

func (*Filter) Size

func (m *Filter) Size() (n int)

func (*Filter) String

func (m *Filter) String() string

func (*Filter) Unmarshal

func (m *Filter) Unmarshal(dAtA []byte) error

func (*Filter) XXX_DiscardUnknown

func (m *Filter) XXX_DiscardUnknown()

func (*Filter) XXX_Marshal

func (m *Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Filter) XXX_Merge

func (m *Filter) XXX_Merge(src proto.Message)

func (*Filter) XXX_Size

func (m *Filter) XXX_Size() int

func (*Filter) XXX_Unmarshal

func (m *Filter) XXX_Unmarshal(b []byte) error

type FilterFunc

type FilterFunc func([]int32) []int32

FilterFunc is generic type for filtering function on nodes.

type Graph

type Graph = *gographviz.Graph

Graph is short synonym for convinience.

type Int32Slice

type Int32Slice []int32

Int32Slice is generic type for more convenient sorting.

func (Int32Slice) Len

func (p Int32Slice) Len() int

func (Int32Slice) Less

func (p Int32Slice) Less(i, j int) bool

func (Int32Slice) Swap

func (p Int32Slice) Swap(i, j int)

type Operation

type Operation int32
const (
	Operation_NP  Operation = 0
	Operation_EQ  Operation = 1
	Operation_NE  Operation = 2
	Operation_GT  Operation = 3
	Operation_GE  Operation = 4
	Operation_LT  Operation = 5
	Operation_LE  Operation = 6
	Operation_OR  Operation = 7
	Operation_AND Operation = 8
)

func (Operation) EnumDescriptor

func (Operation) EnumDescriptor() ([]byte, []int)

func (Operation) String

func (x Operation) String() string

type PlacementRule added in v1.0.6

type PlacementRule struct {
	ReplFactor           uint32    `protobuf:"varint,1,opt,name=ReplFactor,proto3" json:"ReplFactor,omitempty"`
	SFGroups             []SFGroup `protobuf:"bytes,2,rep,name=SFGroups,proto3" json:"SFGroups"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*PlacementRule) Descriptor added in v1.0.6

func (*PlacementRule) Descriptor() ([]byte, []int)

func (*PlacementRule) GetReplFactor added in v1.0.6

func (m *PlacementRule) GetReplFactor() uint32

func (*PlacementRule) GetSFGroups added in v1.0.6

func (m *PlacementRule) GetSFGroups() []SFGroup

func (*PlacementRule) Marshal added in v1.0.6

func (m *PlacementRule) Marshal() (dAtA []byte, err error)

func (*PlacementRule) MarshalTo added in v1.0.6

func (m *PlacementRule) MarshalTo(dAtA []byte) (int, error)

func (*PlacementRule) ProtoMessage added in v1.0.6

func (*PlacementRule) ProtoMessage()

func (*PlacementRule) Reset added in v1.0.6

func (m *PlacementRule) Reset()

func (*PlacementRule) Size added in v1.0.6

func (m *PlacementRule) Size() (n int)

func (*PlacementRule) String added in v1.0.6

func (m *PlacementRule) String() string

func (*PlacementRule) Unmarshal added in v1.0.6

func (m *PlacementRule) Unmarshal(dAtA []byte) error

func (*PlacementRule) XXX_DiscardUnknown added in v1.0.6

func (m *PlacementRule) XXX_DiscardUnknown()

func (*PlacementRule) XXX_Marshal added in v1.0.6

func (m *PlacementRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PlacementRule) XXX_Merge added in v1.0.6

func (m *PlacementRule) XXX_Merge(src proto.Message)

func (*PlacementRule) XXX_Size added in v1.0.6

func (m *PlacementRule) XXX_Size() int

func (*PlacementRule) XXX_Unmarshal added in v1.0.6

func (m *PlacementRule) XXX_Unmarshal(b []byte) error

type Policy

type Policy struct {
	Size       int64
	ReplFactor int
	NodeCount  int
}

Policy specifies parameters for storage selection.

type SFGroup added in v1.0.5

type SFGroup struct {
	Filters              []Filter `protobuf:"bytes,1,rep,name=Filters,proto3" json:"Filters"`
	Selectors            []Select `protobuf:"bytes,2,rep,name=Selectors,proto3" json:"Selectors"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SFGroup) Descriptor added in v1.0.5

func (*SFGroup) Descriptor() ([]byte, []int)

func (*SFGroup) GetFilters added in v1.0.5

func (m *SFGroup) GetFilters() []Filter

func (*SFGroup) GetSelectors added in v1.0.5

func (m *SFGroup) GetSelectors() []Select

func (*SFGroup) Marshal added in v1.0.5

func (m *SFGroup) Marshal() (dAtA []byte, err error)

func (*SFGroup) MarshalTo added in v1.0.5

func (m *SFGroup) MarshalTo(dAtA []byte) (int, error)

func (*SFGroup) ProtoMessage added in v1.0.5

func (*SFGroup) ProtoMessage()

func (*SFGroup) Reset added in v1.0.5

func (m *SFGroup) Reset()

func (*SFGroup) Size added in v1.0.5

func (m *SFGroup) Size() (n int)

func (*SFGroup) String added in v1.0.5

func (m *SFGroup) String() string

func (*SFGroup) Unmarshal added in v1.0.5

func (m *SFGroup) Unmarshal(dAtA []byte) error

func (*SFGroup) XXX_DiscardUnknown added in v1.0.5

func (m *SFGroup) XXX_DiscardUnknown()

func (*SFGroup) XXX_Marshal added in v1.0.5

func (m *SFGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SFGroup) XXX_Merge added in v1.0.5

func (m *SFGroup) XXX_Merge(src proto.Message)

func (*SFGroup) XXX_Size added in v1.0.5

func (m *SFGroup) XXX_Size() int

func (*SFGroup) XXX_Unmarshal added in v1.0.5

func (m *SFGroup) XXX_Unmarshal(b []byte) error

type Select

type Select struct {
	Count                int32    `protobuf:"varint,1,opt,name=Count,proto3" json:"Count,omitempty"`
	Key                  string   `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Select) Descriptor

func (*Select) Descriptor() ([]byte, []int)

func (*Select) GetCount

func (m *Select) GetCount() int32

func (*Select) GetKey

func (m *Select) GetKey() string

func (*Select) Marshal

func (m *Select) Marshal() (dAtA []byte, err error)

func (*Select) MarshalTo

func (m *Select) MarshalTo(dAtA []byte) (int, error)

func (*Select) ProtoMessage

func (*Select) ProtoMessage()

func (*Select) Reset

func (m *Select) Reset()

func (*Select) Size

func (m *Select) Size() (n int)

func (*Select) String

func (m *Select) String() string

func (*Select) Unmarshal

func (m *Select) Unmarshal(dAtA []byte) error

func (*Select) XXX_DiscardUnknown

func (m *Select) XXX_DiscardUnknown()

func (*Select) XXX_Marshal

func (m *Select) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Select) XXX_Merge

func (m *Select) XXX_Merge(src proto.Message)

func (*Select) XXX_Size

func (m *Select) XXX_Size() int

func (*Select) XXX_Unmarshal

func (m *Select) XXX_Unmarshal(b []byte) error

type SimpleFilter

type SimpleFilter struct {
	Op Operation `protobuf:"varint,1,opt,name=Op,proto3,enum=netgraph.Operation" json:"Op,omitempty"`
	// Types that are valid to be assigned to Args:
	//	*SimpleFilter_Value
	//	*SimpleFilter_FArgs
	Args                 isSimpleFilter_Args `protobuf_oneof:"Args"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

func FilterAND

func FilterAND(fs ...*SimpleFilter) *SimpleFilter

FilterAND returns AND combination of filters.

func FilterEQ

func FilterEQ(v string) *SimpleFilter

FilterEQ returns filter, which checks if value is equal to v.

func FilterGE

func FilterGE(v int64) *SimpleFilter

FilterGE returns filter, which checks if value is greater or equal than v.

func FilterGT

func FilterGT(v int64) *SimpleFilter

FilterGT returns filter, which checks if value is greater than v.

func FilterIn

func FilterIn(values ...string) *SimpleFilter

FilterIn returns filter, which checks if value is in specified list.

func FilterLE

func FilterLE(v int64) *SimpleFilter

FilterLE returns filter, which checks if value is less or equal than v.

func FilterLT

func FilterLT(v int64) *SimpleFilter

FilterLT returns filter, which checks if value is less than v.

func FilterNE

func FilterNE(v string) *SimpleFilter

FilterNE returns filter, which checks if value is not equal to v.

func FilterNotIn

func FilterNotIn(values ...string) *SimpleFilter

FilterNotIn returns filter, which checks if value is not in specified list.

func FilterOR

func FilterOR(fs ...*SimpleFilter) *SimpleFilter

FilterOR returns OR combination of filters.

func NewFilter

func NewFilter(op Operation, value string) *SimpleFilter

NewFilter constructs SimpleFilter.

func (SimpleFilter) Check

func (sf SimpleFilter) Check(value string) bool

Check returns result of applying sf to value. For numeric comparisons, value is parsed to int64.

func (*SimpleFilter) Descriptor

func (*SimpleFilter) Descriptor() ([]byte, []int)

func (*SimpleFilter) GetArgs

func (m *SimpleFilter) GetArgs() isSimpleFilter_Args

func (*SimpleFilter) GetFArgs

func (m *SimpleFilter) GetFArgs() *SimpleFilters

func (*SimpleFilter) GetOp

func (m *SimpleFilter) GetOp() Operation

func (*SimpleFilter) GetValue

func (m *SimpleFilter) GetValue() string

func (*SimpleFilter) Marshal

func (m *SimpleFilter) Marshal() (dAtA []byte, err error)

func (*SimpleFilter) MarshalTo

func (m *SimpleFilter) MarshalTo(dAtA []byte) (int, error)

func (*SimpleFilter) ProtoMessage

func (*SimpleFilter) ProtoMessage()

func (*SimpleFilter) Reset

func (m *SimpleFilter) Reset()

func (*SimpleFilter) Size

func (m *SimpleFilter) Size() (n int)

func (*SimpleFilter) String

func (m *SimpleFilter) String() string

func (*SimpleFilter) Unmarshal

func (m *SimpleFilter) Unmarshal(dAtA []byte) error

func (*SimpleFilter) XXX_DiscardUnknown

func (m *SimpleFilter) XXX_DiscardUnknown()

func (*SimpleFilter) XXX_Marshal

func (m *SimpleFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimpleFilter) XXX_Merge

func (m *SimpleFilter) XXX_Merge(src proto.Message)

func (*SimpleFilter) XXX_OneofFuncs

func (*SimpleFilter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*SimpleFilter) XXX_Size

func (m *SimpleFilter) XXX_Size() int

func (*SimpleFilter) XXX_Unmarshal

func (m *SimpleFilter) XXX_Unmarshal(b []byte) error

type SimpleFilter_FArgs

type SimpleFilter_FArgs struct {
	FArgs *SimpleFilters `protobuf:"bytes,3,opt,name=FArgs,proto3,oneof"`
}

func (*SimpleFilter_FArgs) MarshalTo

func (m *SimpleFilter_FArgs) MarshalTo(dAtA []byte) (int, error)

func (*SimpleFilter_FArgs) Size

func (m *SimpleFilter_FArgs) Size() (n int)

type SimpleFilter_Value

type SimpleFilter_Value struct {
	Value string `protobuf:"bytes,2,opt,name=Value,proto3,oneof"`
}

func (*SimpleFilter_Value) MarshalTo

func (m *SimpleFilter_Value) MarshalTo(dAtA []byte) (int, error)

func (*SimpleFilter_Value) Size

func (m *SimpleFilter_Value) Size() (n int)

type SimpleFilters

type SimpleFilters struct {
	Filters              []*SimpleFilter `protobuf:"bytes,1,rep,name=Filters,proto3" json:"Filters,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*SimpleFilters) Descriptor

func (*SimpleFilters) Descriptor() ([]byte, []int)

func (*SimpleFilters) GetFilters

func (m *SimpleFilters) GetFilters() []*SimpleFilter

func (*SimpleFilters) Marshal

func (m *SimpleFilters) Marshal() (dAtA []byte, err error)

func (*SimpleFilters) MarshalTo

func (m *SimpleFilters) MarshalTo(dAtA []byte) (int, error)

func (*SimpleFilters) ProtoMessage

func (*SimpleFilters) ProtoMessage()

func (*SimpleFilters) Reset

func (m *SimpleFilters) Reset()

func (*SimpleFilters) Size

func (m *SimpleFilters) Size() (n int)

func (*SimpleFilters) String

func (m *SimpleFilters) String() string

func (*SimpleFilters) Unmarshal

func (m *SimpleFilters) Unmarshal(dAtA []byte) error

func (*SimpleFilters) XXX_DiscardUnknown

func (m *SimpleFilters) XXX_DiscardUnknown()

func (*SimpleFilters) XXX_Marshal

func (m *SimpleFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimpleFilters) XXX_Merge

func (m *SimpleFilters) XXX_Merge(src proto.Message)

func (*SimpleFilters) XXX_Size

func (m *SimpleFilters) XXX_Size() int

func (*SimpleFilters) XXX_Unmarshal

func (m *SimpleFilters) XXX_Unmarshal(b []byte) error

type Type

type Type int32
const (
	Type_String  Type = 0
	Type_Integer Type = 1
)

func (Type) EnumDescriptor

func (Type) EnumDescriptor() ([]byte, []int)

func (Type) String

func (x Type) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL