vindexes

package
v2.0.0-alpha5+incompat... Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2015 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHash

func NewHash(m map[string]interface{}) (planbuilder.Vindex, error)

NewHash creates a new Hash.

func NewHashAuto

func NewHashAuto(m map[string]interface{}) (planbuilder.Vindex, error)

NewHashAuto creates a new HashAuto.

func NewLookupHash

func NewLookupHash(m map[string]interface{}) (planbuilder.Vindex, error)

NewLookupHash creates a LookupHash vindex.

func NewLookupHashAuto

func NewLookupHashAuto(m map[string]interface{}) (planbuilder.Vindex, error)

NewLookupHashAuto creates a new LookupHashAuto.

func NewLookupHashUnique

func NewLookupHashUnique(m map[string]interface{}) (planbuilder.Vindex, error)

NewLookupHashUnique creates a LookupHashUnique vindex.

func NewLookupHashUniqueAuto

func NewLookupHashUniqueAuto(m map[string]interface{}) (planbuilder.Vindex, error)

NewLookupHashUniqueAuto creates a new LookupHashUniqueAuto.

func NewNumeric

func NewNumeric(_ map[string]interface{}) (planbuilder.Vindex, error)

NewNumeric creates a Numeric vindex.

Types

type Hash

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

Hash defines vindex that hashes an int64 to a KeyspaceId by using null-key 3DES hash. It's Unique, Reversible and Functional.

func (*Hash) Cost

func (vind *Hash) Cost() int

Cost returns the cost of this index as 1.

func (*Hash) Create

func (vind *Hash) Create(vcursor planbuilder.VCursor, id interface{}) error

Create reserves the id by inserting it into the vindex table.

func (*Hash) Delete

func (vind *Hash) Delete(vcursor planbuilder.VCursor, ids []interface{}, _ []byte) error

Delete deletes the entry from the vindex table.

func (*Hash) Map

func (vind *Hash) Map(_ planbuilder.VCursor, ids []interface{}) ([][]byte, error)

Map returns the corresponding KeyspaceId values for the given ids.

func (*Hash) ReverseMap

func (vind *Hash) ReverseMap(_ planbuilder.VCursor, ksid []byte) (interface{}, error)

ReverseMap returns the id from ksid.

func (*Hash) Verify

func (vind *Hash) Verify(_ planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id maps to ksid.

type HashAuto

type HashAuto struct {
	Table, Column string
	// contains filtered or unexported fields
}

HashAuto defines vindex that hashes an int64 to a KeyspaceId by using null-key 3DES hash. It's Unique, Reversible and Functional. Additionally, it's also a FunctionalGenerator because it's capable of generating new values from a vindex table with a single unique autoinc column.

func (*HashAuto) Cost

func (vind *HashAuto) Cost() int

Cost returns the cost of this index as 1.

func (*HashAuto) Create

func (vind *HashAuto) Create(vcursor planbuilder.VCursor, id interface{}) error

Create reserves the id by inserting it into the vindex table.

func (*HashAuto) Delete

func (vind *HashAuto) Delete(vcursor planbuilder.VCursor, ids []interface{}, _ []byte) error

Delete deletes the entry from the vindex table.

func (*HashAuto) Generate

func (vind *HashAuto) Generate(vcursor planbuilder.VCursor) (id int64, err error)

Generate generates a new id by using the autoinc of the vindex table.

func (*HashAuto) Init

func (vind *HashAuto) Init(m map[string]interface{})

Init initializes HashAuto.

func (*HashAuto) Map

func (vind *HashAuto) Map(_ planbuilder.VCursor, ids []interface{}) ([][]byte, error)

Map returns the corresponding KeyspaceId values for the given ids.

func (*HashAuto) ReverseMap

func (vind *HashAuto) ReverseMap(_ planbuilder.VCursor, ksid []byte) (interface{}, error)

ReverseMap returns the id from ksid.

func (*HashAuto) Verify

func (vind *HashAuto) Verify(_ planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id maps to ksid.

type LookupHash

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

LookupHash defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's NonUnique and a Lookup.

func (*LookupHash) Cost

func (vind *LookupHash) Cost() int

Cost returns the cost of this vindex as 20.

func (*LookupHash) Create

func (vind *LookupHash) Create(vcursor planbuilder.VCursor, id interface{}, ksid []byte) error

Create reserves the id by inserting it into the vindex table.

func (*LookupHash) Delete

func (vind *LookupHash) Delete(vcursor planbuilder.VCursor, ids []interface{}, ksid []byte) error

Delete deletes the entry from the vindex table.

func (*LookupHash) Map

func (vind *LookupHash) Map(vcursor planbuilder.VCursor, ids []interface{}) ([][][]byte, error)

Map returns the corresponding KeyspaceId values for the given ids.

func (*LookupHash) Verify

func (vind *LookupHash) Verify(vcursor planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id maps to ksid.

type LookupHashAuto

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

LookupHashAuto defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's NonUnique and a Lookup. It's also a LookupGenerator, because it can use the autoinc capabilities of the lookup table.

func (*LookupHashAuto) Cost

func (vind *LookupHashAuto) Cost() int

Cost returns the cost of this index as 20.

func (*LookupHashAuto) Create

func (vind *LookupHashAuto) Create(vcursor planbuilder.VCursor, id interface{}, ksid []byte) error

Create reserves the id by inserting it into the vindex table.

func (*LookupHashAuto) Delete

func (vind *LookupHashAuto) Delete(vcursor planbuilder.VCursor, ids []interface{}, ksid []byte) error

Delete deletes the entry from the vindex table.

func (*LookupHashAuto) Generate

func (vind *LookupHashAuto) Generate(vcursor planbuilder.VCursor, ksid []byte) (id int64, err error)

Generate reserves the id by inserting it into the vindex table.

func (*LookupHashAuto) Map

func (vind *LookupHashAuto) Map(vcursor planbuilder.VCursor, ids []interface{}) ([][][]byte, error)

Map returns the corresponding KeyspaceId values for the given ids.

func (*LookupHashAuto) Verify

func (vind *LookupHashAuto) Verify(vcursor planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id maps to ksid.

type LookupHashUnique

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

LookupHashUnique defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's Unique and a Lookup.

func (*LookupHashUnique) Cost

func (vind *LookupHashUnique) Cost() int

Cost returns the cost of this vindex as 10.

func (*LookupHashUnique) Create

func (vind *LookupHashUnique) Create(vcursor planbuilder.VCursor, id interface{}, ksid []byte) error

Create reserves the id by inserting it into the vindex table.

func (*LookupHashUnique) Delete

func (vind *LookupHashUnique) Delete(vcursor planbuilder.VCursor, ids []interface{}, ksid []byte) error

Delete deletes the entry from the vindex table.

func (*LookupHashUnique) Map

func (vind *LookupHashUnique) Map(vcursor planbuilder.VCursor, ids []interface{}) ([][]byte, error)

Map returns the corresponding KeyspaceId values for the given ids.

func (*LookupHashUnique) Verify

func (vind *LookupHashUnique) Verify(vcursor planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id maps to ksid.

type LookupHashUniqueAuto

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

LookupHashUniqueAuto defines a vindex that uses a lookup table. The table is expected to define the id column as unique. It's Unique and a Lookup. It's also a LookupGenerator, because it can use the autoinc capabilities of the lookup table.

func (*LookupHashUniqueAuto) Cost

func (vind *LookupHashUniqueAuto) Cost() int

Cost returns the cost of this index as 10.

func (*LookupHashUniqueAuto) Create

func (vind *LookupHashUniqueAuto) Create(vcursor planbuilder.VCursor, id interface{}, ksid []byte) error

Create reserves the id by inserting it into the vindex table.

func (*LookupHashUniqueAuto) Delete

func (vind *LookupHashUniqueAuto) Delete(vcursor planbuilder.VCursor, ids []interface{}, ksid []byte) error

Delete deletes the entry from the vindex table.

func (*LookupHashUniqueAuto) Generate

func (vind *LookupHashUniqueAuto) Generate(vcursor planbuilder.VCursor, ksid []byte) (id int64, err error)

Generate reserves the id by inserting it into the vindex table.

func (*LookupHashUniqueAuto) Map

func (vind *LookupHashUniqueAuto) Map(vcursor planbuilder.VCursor, ids []interface{}) ([][]byte, error)

Map returns the corresponding KeyspaceId values for the given ids.

func (*LookupHashUniqueAuto) Verify

func (vind *LookupHashUniqueAuto) Verify(vcursor planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id maps to ksid.

type Numeric

type Numeric struct{}

Numeric defines a bit-pattern mapping of a uint64 to the KeyspaceId. It's Unique and Reversible.

func (Numeric) Cost

func (Numeric) Cost() int

Cost returns the cost of this vindex as 0.

func (Numeric) Map

func (Numeric) Map(_ planbuilder.VCursor, ids []interface{}) ([][]byte, error)

Map returns the associated keyspae ids for the given ids.

func (Numeric) ReverseMap

func (Numeric) ReverseMap(_ planbuilder.VCursor, ksid []byte) (interface{}, error)

ReverseMap returns the associated id for the ksid.

func (Numeric) Verify

func (Numeric) Verify(_ planbuilder.VCursor, id interface{}, ksid []byte) (bool, error)

Verify returns true if id and ksid match.

Jump to

Keyboard shortcuts

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