utils

package
v0.0.28-dev Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 17 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 FindOrCreateDeterministicThreadID added in v0.0.26

func FindOrCreateDeterministicThreadID(ctx context.Context, variant DeterministicThreadVariant, threadName string, kc keychain.Keychain, st store.Store, threads *tc.Client) (*thread.ID, error)

Finds or creates a thread ID 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 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