query

package module
v1.0.3 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: 4 Imported by: 1

README

Netmap Query Language

Build Status codecov Report GitHub release

Demo

asciicast

SELECT 1 Country FILTER Location NE Europe Example 1

SELECT 2 Country FILTER Country NE Russia Example 2

Description

This is REPL for interacting with netmap with QueryLanguage in NEOFS and applying placement rules to it. Netmap and CRUSH enchacement with FILTERs is described in research plan.

Commands

To see help for specific command type command help.

help

help

Get a list of commands.

exit

exit

Exit program.

load

load <filename>

Load netmap from specified file.

save

save <filename>

Save netmap to specified file.

clear

clear

Clear current netmap.

query

query <STATEMENT>

SELECT Example:

>>> add 1 /Location:Europe/Country:Germany
>>> add 2 /Location:Europe/Country:Austria
>>> add 3 /Location:Asia/Country:Korea
>>> add 4 /Location:Asia/Country:Japan
>>> query SELECT 1 Location
>>> query SELECT 2 Country

FILTER Example

Operation can be one of EQ, NE, LT, LE, GT, GE:

>>> add 1 /Location:Europe/Country:Germany
>>> add 2 /Location:Europe/Country:Austria
>>> query SELECT 1 Country FILTER Country NE Austria

RF Example

Replication factor

>>> add 1 /Location:Europe/Country:Germany
>>> add 2 /Location:Europe/Country:France
>>> add 3 /Location:Europe/Country:Austria
>>> query RF 1 SELECT 1 Country FILTER Country NE Austria
get-selection

get-selection

Get nodes from current selection.

Example:

>>> load /examples/map2
>>> query SELECT 1 Country FILTER Location NE Asia
>>> get-selection
[13 14]
clear-selection

clear-selection

Clear current selection.

dump-selection

dump-selection <filename>

Dump netmap in graphical format. If using docker, /pics directory is mounted as temp on host.

Documentation

Index

Constants

View Source
const (
	// OperationEQ A == B
	OperationEQ = netgraph.Operation_EQ
	// OperationNE A != B
	OperationNE = netgraph.Operation_NE
	// OperationLT A < B
	OperationLT = netgraph.Operation_LT
	// OperationLE A <= B
	OperationLE = netgraph.Operation_LE
	// OperationGT A > B
	OperationGT = netgraph.Operation_GT
	// OperationGE A >= B
	OperationGE = netgraph.Operation_GE
)

Variables

View Source
var (
	// FilterEQ returns filter, which checks if value is equal to v.
	FilterEQ = netgraph.FilterEQ
	// FilterNE returns filter, which checks if value is not equal to v.
	FilterNE = netgraph.FilterNE
	// FilterGT returns filter, which checks if value is greater than v.
	FilterGT = netgraph.FilterGT
	// NewFilter constructs SimpleFilter.
	NewFilter = netgraph.NewFilter
)

Functions

func ParseQuery

func ParseQuery(s string) (*netgraph.PlacementRule, error)

ParseQuery converts string to netgraph.PlacementRule struct

Types

type Filter

type Filter = netgraph.Filter

Filter struct

type Operation

type Operation = netgraph.Operation

Operation struct

type SFGroup added in v1.0.1

type SFGroup = netgraph.SFGroup

SFGroup struct

type Select

type Select = netgraph.Select

Select struct

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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