luci: go.chromium.org/luci/tokenserver/appengine/impl/utils/shards Index | Files

package shards

import "go.chromium.org/luci/tokenserver/appengine/impl/utils/shards"

Package shards provides a low level support for implementing sharded set of []byte blobs.

Index

Package Files

shards.go

func ShardIndex Uses

func ShardIndex(member []byte, shardCount int) int

ShardIndex returns an index of a shard to use when storing given blob.

type Set Uses

type Set []Shard

Set is an array of shards (representing a single sharded set).

The size of the array is number of shards in the set. Allocate it using regular make(...).

func (Set) Insert Uses

func (s Set) Insert(blob []byte)

Insert adds a blob into the sharded set.

type Shard Uses

type Shard map[string]struct{}

Shard is a set of byte blobs.

It represents s single shard of a sharded set.

func ParseShard Uses

func ParseShard(blob []byte) (Shard, error)

ParseShard deserializes a shard (serialized with Serialize).

func (Shard) Serialize Uses

func (s Shard) Serialize() []byte

Serialize serializes the shard to a byte buffer.

Package shards imports 4 packages (graph) and is imported by 2 packages. Updated 2018-12-16. Refresh now. Tools for package owners.