commonspace

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 44 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")
View Source
var (
	ErrSpaceClosed = errors.New("space is closed")
)

Functions

func NewSpaceId

func NewSpaceId(id string, repKey uint64) string

func ValidateSpaceHeader

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

Types

type BuildTreeOpts

type BuildTreeOpts struct {
	Listener           updatelistener.UpdateListener
	WaitTreeRemoteSync bool
	// contains filtered or unexported fields
}

type Config

type Config struct {
	GCTTL                int  `yaml:"gcTTL"`
	SyncPeriod           int  `yaml:"syncPeriod"`
	KeepTreeDataInMemory bool `yaml:"keepTreeDataInMemory"`
}

type ConfigGetter

type ConfigGetter interface {
	GetSpace() Config
}

type HandleMessage

type HandleMessage struct {
	Id                uint64
	ReceiveTime       time.Time
	StartHandlingTime time.Time
	Deadline          time.Time
	SenderId          string
	Message           *spacesyncproto.ObjectSyncMessage
	PeerCtx           context.Context
}

func (HandleMessage) LogFields

func (m HandleMessage) LogFields(fields ...zap.Field) []zap.Field

type HistoryTreeOpts

type HistoryTreeOpts struct {
	BeforeId      string
	Include       bool
	BuildFullTree bool
}

type Space

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

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

	CreateTree(ctx context.Context, payload objecttree.ObjectTreeCreatePayload) (res treestorage.TreeStorageCreatePayload, err error)
	PutTree(ctx context.Context, payload treestorage.TreeStorageCreatePayload, listener updatelistener.UpdateListener) (t objecttree.ObjectTree, err error)
	BuildTree(ctx context.Context, id string, opts BuildTreeOpts) (t objecttree.ObjectTree, err error)
	DeleteTree(ctx context.Context, id string) (err error)
	BuildHistoryTree(ctx context.Context, id string, opts HistoryTreeOpts) (t objecttree.HistoryTree, err error)

	SpaceDeleteRawChange(ctx context.Context) (raw *treechangeproto.RawTreeChangeWithId, err error)
	DeleteSpace(ctx context.Context, deleteChange *treechangeproto.RawTreeChangeWithId) (err error)

	HeadSync() headsync.HeadSync
	ObjectSync() objectsync.ObjectSync
	SyncStatus() syncstatus.StatusUpdater
	Storage() spacestorage.SpaceStorage

	HandleMessage(ctx context.Context, msg HandleMessage) (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
	// ReadKey is a first symmetric encryption key for a space
	ReadKey []byte
	// 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
}

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) (sp Space, err error)
	app.Component
}

func New

func New() SpaceService

Directories

Path Synopsis
mock_credentialprovider
Package mock_credentialprovider is a generated GoMock package.
Package mock_credentialprovider is a generated GoMock package.
mock_headsync
Package mock_headsync is a generated GoMock package.
Package mock_headsync is a generated GoMock package.
object
acl/list/mock_list
Package mock_list is a generated GoMock package.
Package mock_list is a generated GoMock package.
acl/liststorage/mock_liststorage
Package mock_liststorage is a generated GoMock package.
Package mock_liststorage is a generated GoMock package.
tree/objecttree/mock_objecttree
Package mock_objecttree is a generated GoMock package.
Package mock_objecttree is a generated GoMock package.
tree/synctree/mock_synctree
Package mock_synctree is a generated GoMock package.
Package mock_synctree is a generated GoMock package.
tree/synctree/updatelistener/mock_updatelistener
Package mock_updatelistener is a generated GoMock package.
Package mock_updatelistener is a generated GoMock package.
tree/treestorage/mock_treestorage
Package mock_treestorage is a generated GoMock package.
Package mock_treestorage is a generated GoMock package.
treemanager/mock_treemanager
Package mock_treemanager is a generated GoMock package.
Package mock_treemanager is a generated GoMock package.
mock_objectsync
Package mock_objectsync is a generated GoMock package.
Package mock_objectsync is a generated GoMock package.
mock_peermanager
Package mock_peermanager is a generated GoMock package.
Package mock_peermanager is a generated GoMock package.
mock_settings
Package mock_settings is a generated GoMock package.
Package mock_settings is a generated GoMock package.
settingsstate/mock_settingsstate
Package mock_settingsstate is a generated GoMock package.
Package mock_settingsstate is a generated GoMock package.
mock_spacestorage
Package mock_spacestorage is a generated GoMock package.
Package mock_spacestorage is a generated GoMock package.
mock_spacesyncproto
Package mock_spacesyncproto is a generated GoMock package.
Package mock_spacesyncproto is a generated GoMock package.

Jump to

Keyboard shortcuts

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