commonspace

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const AddSpaceCtxKey ctxKey = 0
View Source
const CName = "common.commonspace"
View Source
const (
	SpaceReserved = "any-sync.space"
)

Variables

View Source
var ErrIncorrectIdentity = errors.New("incorrect identity")

Functions

func NewSpaceId

func NewSpaceId(id string, repKey uint64) string

func ValidateSpaceHeader

func ValidateSpaceHeader(rawHeaderWithId *spacesyncproto.RawSpaceHeaderWithId, identity crypto.PubKey) (err error)

Types

type Deps added in v0.3.2

type Deps struct {
	TreeSyncer treesyncer.TreeSyncer
}

type Space

type Space interface {
	Id() string
	Init(ctx context.Context) error
	Acl() syncacl.SyncAcl

	StoredIds() []string
	DebugAllHeads() []headsync.TreeHeads
	Description() (desc SpaceDescription, err error)

	TreeBuilder() objecttreebuilder.TreeBuilder
	TreeSyncer() treesyncer.TreeSyncer
	SyncStatus() syncstatus.StatusUpdater
	Storage() spacestorage.SpaceStorage

	DeleteTree(ctx context.Context, id string) (err error)
	GetNodePeers(ctx context.Context) (peer []peer.Peer, err error)

	HandleMessage(ctx context.Context, msg objectsync.HandleMessage) (err error)
	HandleSyncRequest(ctx context.Context, req *spacesyncproto.ObjectSyncMessage) (resp *spacesyncproto.ObjectSyncMessage, err error)
	HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)

	TryClose(objectTTL time.Duration) (close bool, err error)
	Close() error
}

type SpaceCreatePayload

type SpaceCreatePayload struct {
	// SigningKey is the signing key of the owner
	SigningKey crypto.PrivKey
	// SpaceType is an arbitrary string
	SpaceType string
	// ReplicationKey is a key which is to be used to determine the node where the space should be held
	ReplicationKey uint64
	// SpacePayload is an arbitrary payload related to space type
	SpacePayload []byte
	// MasterKey is the master key of the owner
	MasterKey crypto.PrivKey
	// ReadKey is the first read key of space
	ReadKey crypto.SymKey
	// MetadataKey is the first metadata key of space
	MetadataKey crypto.PrivKey
	// Metadata is the metadata of the owner
	Metadata []byte
}

type SpaceDerivePayload

type SpaceDerivePayload struct {
	SigningKey   crypto.PrivKey
	MasterKey    crypto.PrivKey
	SpaceType    string
	SpacePayload []byte
}

type SpaceDescription

type SpaceDescription struct {
	SpaceHeader          *spacesyncproto.RawSpaceHeaderWithId
	AclId                string
	AclPayload           []byte
	SpaceSettingsId      string
	SpaceSettingsPayload []byte
}

type SpaceService

type SpaceService interface {
	DeriveSpace(ctx context.Context, payload SpaceDerivePayload) (string, error)
	DeriveId(ctx context.Context, payload SpaceDerivePayload) (string, error)
	CreateSpace(ctx context.Context, payload SpaceCreatePayload) (string, error)
	NewSpace(ctx context.Context, id string, deps Deps) (sp Space, err error)
	app.Component
}

func New

func New() SpaceService

Directories

Path Synopsis
mock_credentialprovider
Code generated by MockGen.
Code generated by MockGen.
mock_deletionmanager
Code generated by MockGen.
Code generated by MockGen.
mock_deletionstate
Code generated by MockGen.
Code generated by MockGen.
mock_headsync
Code generated by MockGen.
Code generated by MockGen.
Code generated by MockGen.
Code generated by MockGen.
object
acl/list/mock_list
Code generated by MockGen.
Code generated by MockGen.
acl/liststorage/mock_liststorage
Code generated by MockGen.
Code generated by MockGen.
acl/syncacl/mock_syncacl
Code generated by MockGen.
Code generated by MockGen.
tree/objecttree/mock_objecttree
Code generated by MockGen.
Code generated by MockGen.
tree/synctree/mock_synctree
Code generated by MockGen.
Code generated by MockGen.
Code generated by MockGen.
tree/treestorage/mock_treestorage
Code generated by MockGen.
Code generated by MockGen.
treemanager/mock_treemanager
Code generated by MockGen.
Code generated by MockGen.
treesyncer/mock_treesyncer
Code generated by MockGen.
Code generated by MockGen.
mock_objectsync
Code generated by MockGen.
Code generated by MockGen.
mock_objecttreebuilder
Code generated by MockGen.
Code generated by MockGen.
mock_peermanager
Code generated by MockGen.
Code generated by MockGen.
settingsstate/mock_settingsstate
Code generated by MockGen.
Code generated by MockGen.
mock_spacestorage
Code generated by MockGen.
Code generated by MockGen.
mock_spacesyncproto
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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