utils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastDbIDToString

func CastDbIDToString(dbID thread.ID) string

func FindOrCreateDeterministicThread added in v0.0.30

func FindOrCreateDeterministicThread(
	ctx context.Context,
	variant DeterministicThreadVariant,
	threadName string,
	kc keychain.Keychain,
	st store.Store,
	threads *tc.Client,
	cfg config.Config,
	netc *nc.Client,
	hnetc *nc.Client,
	hubAuth hub.HubAuth,
	shouldForceRestore bool,
	dbCollectionConfigs []db.CollectionConfig,
) (*thread.ID, error)

Finds or creates a thread that's based on the user private key and the specified variant Using the same private key, variant and thread name will always end up generating the same key

func GetThreadContext

func GetThreadContext(parentCtx context.Context, threadName string, dbID thread.ID, hub bool, kc keychain.Keychain, hubAuth hub.HubAuth, threadsClient *tc.Client) (context.Context, error)

Readies a context to access a thread given its name and dbid

func IsMetaFileName added in v0.0.22

func IsMetaFileName(pathOrName string) bool

func MapDirEntryToFileInfo added in v0.0.33

func MapDirEntryToFileInfo(entry bucketsproto.ListPathResponse, itemPath string) domain.FileInfo

func NewDeterministicThreadID

func NewDeterministicThreadID(kc keychain.Keychain, threadVariant DeterministicThreadVariant) (thread.ID, error)

func ParseDbIDFromString

func ParseDbIDFromString(dbID string) (*thread.ID, error)

func RandBytes

func RandBytes(size int) ([]byte, error)

randBytes returns random bytes in a byte slice of size.

Types

type DeterministicThreadVariant

type DeterministicThreadVariant string
const (
	MetathreadThreadVariant DeterministicThreadVariant = "metathread"
	MirrorBucketVariant     DeterministicThreadVariant = "mirror_bucket"
)

func MirrorBucketVariantGen added in v0.0.30

func MirrorBucketVariantGen(mirrorBucketSlug string) DeterministicThreadVariant

Jump to

Keyboard shortcuts

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