index

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRetriesExceeded = fmt.Errorf("config journal unavailable after %d attempts", maxRetries)
	ErrNoSuchRule      = errors.New("no such rule")
)
View Source
var RuleTypes = []interface{}{
	AddRule{},
	DeleteRule{},
	FieldRule{},
	TypeRule{},
	AggRule{},
}

Functions

func Equivalent

func Equivalent(a, b Rule) bool

Equivalent returns true if the two rules create the same index object.

func ObjectName

func ObjectName(ruleID, id ksuid.KSUID) string

func ObjectPath added in v0.32.0

func ObjectPath(path *storage.URI, ruleID, id ksuid.KSUID) *storage.URI

func Serialize added in v1.2.0

func Serialize(r interface{}) ([]byte, error)

Types

type AddRule

type AddRule struct {
	Rule Rule
}

type AggRule

type AggRule struct {
	Ts     nano.Ts     `zed:"ts"`
	ID     ksuid.KSUID `zed:"id"`
	Name   string      `zed:"name"`
	Script string      `zed:"script"`
}

func NewAggRule

func NewAggRule(c runtime.Compiler, name, prog string) (*AggRule, error)

func (*AggRule) CreateTime

func (a *AggRule) CreateTime() nano.Ts

func (*AggRule) RuleID

func (a *AggRule) RuleID() ksuid.KSUID

func (*AggRule) RuleKeys

func (a *AggRule) RuleKeys() field.List

func (*AggRule) RuleName

func (a *AggRule) RuleName() string

func (*AggRule) String

func (a *AggRule) String() string

func (*AggRule) Zed

func (a *AggRule) Zed() string

type Combiner

type Combiner []*Writer

func NewCombiner

func NewCombiner(ctx context.Context, c runtime.Compiler, engine storage.Engine, path *storage.URI, rules []Rule, id ksuid.KSUID) (Combiner, error)

func (Combiner) Abort

func (c Combiner) Abort()

func (Combiner) Close

func (c Combiner) Close() (merr error)

func (Combiner) References

func (c Combiner) References() []*Object

func (Combiner) Write

func (c Combiner) Write(rec *zed.Value) error

type DeleteRule

type DeleteRule struct {
	ID ksuid.KSUID
}

type FieldRule

type FieldRule struct {
	Ts     nano.Ts     `zed:"ts"`
	ID     ksuid.KSUID `zed:"id"`
	Name   string      `zed:"name"`
	Fields field.List  `zed:"fields,omitempty"`
}

func NewFieldRule

func NewFieldRule(name, keys string) *FieldRule

func (*FieldRule) CreateTime

func (f *FieldRule) CreateTime() nano.Ts

func (*FieldRule) RuleID

func (f *FieldRule) RuleID() ksuid.KSUID

func (*FieldRule) RuleKeys

func (f *FieldRule) RuleKeys() field.List

func (*FieldRule) RuleName

func (f *FieldRule) RuleName() string

func (*FieldRule) String

func (f *FieldRule) String() string

func (*FieldRule) Zed

func (f *FieldRule) Zed() string

type Filter added in v0.32.0

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

func NewFilter added in v0.32.0

func NewFilter(engine storage.Engine, path *storage.URI, pushdown dag.Expr) *Filter

func (*Filter) Apply added in v0.32.0

func (f *Filter) Apply(ctx context.Context, oid ksuid.KSUID, rules []Rule) (extent.Span, error)

type Map

type Map map[ksuid.KSUID]ObjectRules

func (Map) All

func (m Map) All() []*Object

func (Map) Copy

func (m Map) Copy() Map

func (Map) Delete

func (m Map) Delete(ruleID, id ksuid.KSUID)

func (Map) Exists

func (m Map) Exists(object *Object) bool

func (Map) Insert

func (m Map) Insert(object *Object)

func (Map) Lookup

func (m Map) Lookup(ruleID, id ksuid.KSUID) *Object

type Object

type Object struct {
	Rule Rule        `zed:"rule"`
	ID   ksuid.KSUID `zed:"id"`
}

func (Object) Path

func (o Object) Path(path *storage.URI) *storage.URI

func (Object) String

func (o Object) String() string

type ObjectRules

type ObjectRules map[ksuid.KSUID]*Object

func (ObjectRules) Missing

func (o ObjectRules) Missing(rules []Rule) []Rule

func (ObjectRules) Rules added in v0.32.0

func (o ObjectRules) Rules() []Rule

type Rule

type Rule interface {
	CreateTime() nano.Ts
	RuleName() string
	RuleID() ksuid.KSUID
	RuleKeys() field.List
	Zed() string
	String() string
}

type Store

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

func CreateStore

func CreateStore(ctx context.Context, engine storage.Engine, path *storage.URI) (*Store, error)

func OpenStore

func OpenStore(ctx context.Context, engine storage.Engine, path *storage.URI) (*Store, error)

func (*Store) Add

func (s *Store) Add(ctx context.Context, rule Rule) error

func (*Store) All

func (s *Store) All(ctx context.Context) ([]Rule, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id ksuid.KSUID) (Rule, error)

func (*Store) IDs

func (s *Store) IDs(ctx context.Context) ([]ksuid.KSUID, error)

func (*Store) LookupByID

func (s *Store) LookupByID(ctx context.Context, id ksuid.KSUID) (Rule, error)

func (*Store) LookupByRef added in v1.3.0

func (s *Store) LookupByRef(ctx context.Context, ref string) ([]Rule, error)

LookupByRef returns the rules that match the passed ref string. ref can be either a rule's Name or ID in alphanumeric base62 encoding.

func (*Store) Names

func (s *Store) Names(ctx context.Context) ([]string, error)

type TypeRule

type TypeRule struct {
	Ts   nano.Ts     `zed:"ts"`
	ID   ksuid.KSUID `zed:"id"`
	Name string      `zed:"name"`
	Type string      `zed:"type"`
}

func NewTypeRule

func NewTypeRule(name string, typ zed.Type) *TypeRule

func (*TypeRule) CreateTime

func (t *TypeRule) CreateTime() nano.Ts

func (*TypeRule) RuleID

func (t *TypeRule) RuleID() ksuid.KSUID

func (*TypeRule) RuleKeys

func (t *TypeRule) RuleKeys() field.List

func (*TypeRule) RuleName

func (t *TypeRule) RuleName() string

func (*TypeRule) String

func (t *TypeRule) String() string

func (*TypeRule) Zed

func (t *TypeRule) Zed() string

type Writer

type Writer struct {
	Object *Object
	URI    *storage.URI
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(ctx context.Context, c runtime.Compiler, engine storage.Engine, path *storage.URI, object *Object) (*Writer, error)

func (*Writer) Abort

func (w *Writer) Abort()

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Write

func (w *Writer) Write(rec *zed.Value) error

Jump to

Keyboard shortcuts

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