search

package
v0.1.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

README

Filters

The --search-common-action-filter-on-expr and --search-common-action-filter-out-expr parameters are both CEL programs.

NOTE: They filter what gets indexed into search. They are not a language you can use to query the indexes.

CEL is Google's Common Expression Language:

Identifiers

The same list of identifiers available for searching in dfuse Search is available for filtering.

For example, a dfuse Search of:

receiver:eosio.token data.from:bob

would be filtered as:

receiver == 'eosio.token' && data.from == 'bob'

See https://docs.dfuse.io/reference/eosio/search-terms/ for all EOSIO terms that can be filtered.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EOSIndexedFields = []search.IndexedField{
	{"account", search.AccountType},
	{"active", search.FreeFormType},
	{"active_key", search.FreeFormType},
	{"actor", search.FreeFormType},
	{"amount", search.AssetType},
	{"auth", search.FreeFormType},
	{"authority", search.FreeFormType},
	{"bid", search.FreeFormType},
	{"bidder", search.AccountType},
	{"canceler", search.AccountType},
	{"creator", search.AccountType},
	{"executer", search.AccountType},
	{"from", search.AccountType},
	{"is_active", search.BooleanType},
	{"is_priv", search.BooleanType},
	{"isproxy", search.BooleanType},
	{"issuer", search.AccountType},
	{"level", search.FreeFormType},
	{"location", search.FreeFormType},
	{"maximum_supply", search.AssetType},
	{"name", search.NameType},
	{"newname", search.NameType},
	{"owner", search.AccountType},
	{"parent", search.AccountType},
	{"payer", search.AccountType},
	{"permission", search.PermissionType},
	{"producer", search.AccountType},
	{"producer_key", search.FreeFormType},
	{"proposal_name", search.NameType},
	{"proposal_hash", search.FreeFormType},
	{"proposer", search.AccountType},
	{"proxy", search.FreeFormType},
	{"public_key", search.FreeFormType},
	{"producers", search.FreeFormType},
	{"quant", search.FreeFormType},
	{"quantity", search.FreeFormType},
	{"ram_payer", search.AccountType},
	{"receiver", search.AccountType},
	{"requested", search.BooleanType},
	{"requirement", search.FreeFormType},
	{"symbol", search.FreeFormType},
	{"threshold", search.FreeFormType},
	{"to", search.AccountType},
	{"transfer", search.FreeFormType},
	{"voter", search.AccountType},
	{"voter_name", search.NameType},
	{"weight", search.FreeFormType},
}
View Source
var TestMatchCollector = func(ctx context.Context, lowBlockNum, highBlockNum uint64, results bsearch.DocumentMatchCollection) (out []search.SearchMatch, err error) {
	trxs := make(map[string][]uint16)
	var trxList []*testTrxResult

	for _, el := range results {
		if err := ctx.Err(); err != nil {
			return nil, err
		}

		blockNum, trxID, actionIdx, skip := testExplodeDocumentID(el.ID)
		if skip {
			continue
		}

		if blockNum < lowBlockNum || blockNum > highBlockNum {
			continue
		}

		if _, found := trxs[trxID]; !found {
			trxList = append(trxList, &testTrxResult{
				id:       trxID,
				blockNum: blockNum,
			})
		}

		trxs[trxID] = append(trxs[trxID], actionIdx)
	}

	for _, trx := range trxList {
		actions := trxs[trx.id]
		sort.Slice(actions, func(i, j int) bool { return actions[i] < actions[j] })

		out = append(out, &EOSSearchMatch{
			TrxIDPrefix:   trx.id,
			ActionIndexes: actions,
			BlockNumber:   trx.blockNum,
		})
	}

	return out, nil
}

Functions

func Collect

func Collect(ctx context.Context, lowBlockNum, highBlockNum uint64, results bsearch.DocumentMatchCollection) (out []search.SearchMatch, err error)

func EOSDocumentID

func EOSDocumentID(blockNum uint64, transactionID string, actionIndex int) string

func ExplodeEOSDocumentID

func ExplodeEOSDocumentID(ref string) (blockNum uint64, trxID string, actionIdx uint16, skip bool)

func GetEOSIndexedFields

func GetEOSIndexedFields() []*search.IndexedField

GetIndexedFields returns the list of indexed fields of the service, from the cached list of indexed fields. Function `InitIndexedFields` must be called prior using this function.

func GetEOSIndexedFieldsMap

func GetEOSIndexedFieldsMap() map[string]*search.IndexedField

func InitEOSIndexedFields

func InitEOSIndexedFields()

InitIndexedFields initialize the list of indexed fields of the service

Types

type EOSBleveQueryValidator

type EOSBleveQueryValidator struct{}

func (*EOSBleveQueryValidator) Validate

type EOSBlockMapper

type EOSBlockMapper struct {
	// contains filtered or unexported fields
}

func NewEOSBlockMapper

func NewEOSBlockMapper(hooksActionName string, filterOn, filterOut string) (*EOSBlockMapper, error)

func (*EOSBlockMapper) IndexMapping

func (m *EOSBlockMapper) IndexMapping() *mapping.IndexMappingImpl

func (*EOSBlockMapper) Map

type EOSSearchMatch

type EOSSearchMatch struct {
	TrxIDPrefix   string   `json:"prefix"` // ID prefix
	ActionIndexes []uint16 `json:"acts"`   // Action indexes within the transactions
	BlockNumber   uint64   `json:"blk"`    // Current block for this trx
	Index         uint64   `json:"idx"`    // Index of the matching transaction within a block (depends on order of sort)
}

func (*EOSSearchMatch) BlockNum

func (m *EOSSearchMatch) BlockNum() uint64

func (*EOSSearchMatch) FillProtoSpecific

func (m *EOSSearchMatch) FillProtoSpecific(match *pbsearch.SearchMatch, block *bstream.Block) (err error)

func (*EOSSearchMatch) GetIndex

func (m *EOSSearchMatch) GetIndex() uint64

func (*EOSSearchMatch) SetIndex

func (m *EOSSearchMatch) SetIndex(index uint64)

func (*EOSSearchMatch) TransactionIDPrefix

func (m *EOSSearchMatch) TransactionIDPrefix() string

Jump to

Keyboard shortcuts

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