bigtable

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BtPlaceStatsVarPrefix for place to statsvar list cache.
	BtPlaceStatsVarPrefix = "d/0/"
	// BtStatVarGroup is the key for statvar group cache.
	BtStatVarGroup = "d/1"
	// BtSVAndSVGExistence is the key for stat var and stat var group existence cache.
	BtSVAndSVGExistence = "d/2/"
	// BtPlacePagePrefix for place page cache.
	BtPlacePagePrefix = "d/4/"
	// BtProteinPagePrefix for protein page cache.
	BtProteinPagePrefix = "d/6/"
	// BtTriplesPrefix for internal GetTriples cache.
	BtTriplesPrefix = "d/7/"
	// BtArcsPrefix for internal arcs cache.
	BtArcsPrefix = "d/9/"
	// BtStatVarSummary for stat var summary cache.
	BtStatVarSummary = "d/a/"
	// BtPlacesInPrefix for GetPlacesIn cache.
	BtPlacesInPrefix = "d/c/"
	// BtPlacesMetadataPrefix for GetPlaceMetadata cache.
	BtPlacesMetadataPrefix = "d/d/"
	// BtChartDataPrefix for chart data.
	BtChartDataPrefix = "d/f/"
	// BtInPropValPrefix for in-arc prop value.
	BtInPropValPrefix = "d/l/"
	// BtOutPropValPrefix for out-arc prop value.
	BtOutPropValPrefix = "d/m/"
	// BtRelatedLocationsSameTypePrefix for related places with same type.
	BtRelatedLocationsSameTypePrefix = "d/o/"
	// BtRelatedLocationsSameTypeAndAncestorPrefix for related places with same type and ancestor.
	BtRelatedLocationsSameTypeAndAncestorPrefix = "d/q/"
	// BtRelatedLocationsSameTypePCPrefix for related places with same type, per capita.
	BtRelatedLocationsSameTypePCPrefix = "d/o0/"
	// BtRelatedLocationsSameTypeAndAncestorPCPrefix for related places with same type and ancestor,
	// per capita.
	BtRelatedLocationsSameTypeAndAncestorPCPrefix = "d/q0/"

	// BtFamily is the key for the row.
	BtFamily = "csv"
	// BtCacheLimit is the cache limit. The limit is per predicate and neighbor type.
	BtCacheLimit = 500
	// BtBatchQuerySize is the size of BigTable batch query.
	BtBatchQuerySize = 1000
)

Variables

This section is empty.

Functions

func BuildPlaceInKey

func BuildPlaceInKey(dcids []string, placeType string) bigtable.RowList

BuildPlaceInKey builds bigtable key for place in cache

func BuildPlaceMetaDataKey

func BuildPlaceMetaDataKey(places []string) bigtable.RowList

BuildPlaceMetaDataKey builds Bigtable key for place metadata cache

func BuildPlaceStatsVarKey

func BuildPlaceStatsVarKey(dcids []string) bigtable.RowList

BuildPlaceStatsVarKey builds bigtable key for place stat vars cache

func BuildPropertyLabelKey

func BuildPropertyLabelKey(dcids []string) bigtable.RowList

BuildPropertyLabelKey builds bigtable key for property label cache

func BuildPropertyValuesKey

func BuildPropertyValuesKey(
	dcids []string, prop string, arcOut bool) bigtable.RowList

BuildPropertyValuesKey builds bigtable key for property value cache

func BuildStatExistenceKey

func BuildStatExistenceKey(
	places []string, statVars []string) (
	bigtable.RowList, map[string]*util.PlaceStatVar)

BuildStatExistenceKey builds bigtable key for stat existence cache

func BuildStatSetWithinPlaceKey

func BuildStatSetWithinPlaceKey(parentPlace, childType, date string, statVars []string) (
	bigtable.RowList, map[string]string)

BuildStatSetWithinPlaceKey builds bigtable key for stat within-place cache

func BuildStatVarSummaryKey

func BuildStatVarSummaryKey(statVars []string) bigtable.RowList

BuildStatVarSummaryKey builds bigtable key for place stat var summary cache

func BuildStatsKey

func BuildStatsKey(
	places []string, statVars []string) (
	bigtable.RowList, map[string]*util.PlaceStatVar)

BuildStatsKey builds bigtable key for stat cache

func BuildTriplesKey

func BuildTriplesKey(dcids []string) bigtable.RowList

BuildTriplesKey builds bigtable key for triples cache

func Read

func Read(
	ctx context.Context,
	btGroup *Group,
	rowSet cbt.RowSet,
	action func(string, []byte) (interface{}, error),
	getToken func(string) (string, error),
	readBranch bool,
) (
	map[string]interface{}, map[string]interface{}, error,
)

bigTableReadRowsParallel reads BigTable rows from base Bigtable and branch Bigtable in parallel.

Reading multiple rows is chunked as the size limit for RowSet is 500KB.

Args: baseBt: The bigtable that holds the base cache branchBt: The bigtable that holds the branch cache. rowSet: BigTable rowSet containing the row keys. action: A callback function that converts the raw bytes into appropriate

go struct based on the cache content.

getToken: A function to get back the indexed token (like place dcid) from

bigtable row key.

func SetupBigtable

func SetupBigtable(
	ctx context.Context, data map[string]string) (*bigtable.Table, error)

SetupBigtable creates a testing bigtable instance used for testing

Types

type Group

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

Group represents all the cloud bigtables that mixer talks to.

func NewBigtableGroup

func NewBigtableGroup(
	baseTable *cbt.Table,
	branchTable *cbt.Table,
) *Group

NewBigtableGroup creates a BigtableGroup

func (*Group) BaseBt

func (st *Group) BaseBt() *cbt.Table

BaseBt is the accessor for base bigtable

func (*Group) BranchBt

func (st *Group) BranchBt() *cbt.Table

BranchBt is the accessor for branch bigtable

func (*Group) UpdateBranchBt

func (st *Group) UpdateBranchBt(branchTable *cbt.Table)

UpdateBranchBt updates the branch bigtable

Jump to

Keyboard shortcuts

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