spacestatus

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpaceStatusCreated = iota
	SpaceStatusDeletionPending
	SpaceStatusDeletionStarted
	SpaceStatusDeleted
)
View Source
const CName = "coordinator.spacestatus"

Variables

View Source
var (
	ErrStatusExists = errors.New("space status exists")
)

Functions

This section is empty.

Types

type AccountDeletion added in v0.3.3

type AccountDeletion struct {
	DeletionPayload   []byte
	DeletionPayloadId string
	AccountInfo
}

type AccountInfo added in v0.3.3

type AccountInfo struct {
	Identity  crypto.PubKey
	PeerId    string
	NetworkId string
}

type ChangeVerifier

type ChangeVerifier interface {
	Verify(change StatusChange) (err error)
}

type Config

type Config struct {
	RunSeconds         int `yaml:"runSeconds"`
	DeletionPeriodDays int `yaml:"deletionPeriodDays"`
	SpaceLimit         int `yaml:"spaceLimit"`
}

type Deleter added in v0.3.0

type Deleter func(ctx context.Context, spaceId string) (err error)

type SpaceDeleter

type SpaceDeleter interface {
	Run(spaces *mongo.Collection, delSender Deleter)
	Close()
}

type SpaceDeletion added in v0.3.3

type SpaceDeletion struct {
	DeletionPayload   []byte
	DeletionPayloadId string
	SpaceId           string
	DeletionPeriod    time.Duration
	AccountInfo
}

type SpaceStatus

type SpaceStatus interface {
	NewStatus(ctx context.Context, spaceId string, identity, oldIdentity crypto.PubKey, spaceType SpaceType, force bool) (err error)
	// ChangeStatus is deprecated, use only for backwards compatibility
	ChangeStatus(ctx context.Context, change StatusChange) (entry StatusEntry, err error)
	SpaceDelete(ctx context.Context, payload SpaceDeletion) (toBeDeleted int64, err error)
	AccountDelete(ctx context.Context, payload AccountDeletion) (toBeDeleted int64, err error)
	AccountRevertDeletion(ctx context.Context, payload AccountInfo) (err error)
	Status(ctx context.Context, spaceId string) (entry StatusEntry, err error)

	MakeShareable(ctx context.Context, spaceId string, limit uint32) (err error)
	MakeUnshareable(ctx context.Context, spaceId string) (err error)

	app.ComponentRunnable
}

func New

func New() SpaceStatus

type SpaceType added in v0.3.2

type SpaceType int
const (
	SpaceTypePersonal SpaceType = iota
	SpaceTypeTech
	SpaceTypeRegular
)

func VerifySpaceHeader added in v0.3.2

func VerifySpaceHeader(identity crypto.PubKey, headerBytes []byte) (spaceType SpaceType, err error)

type StatusChange

type StatusChange struct {
	DeletionPayloadType coordinatorproto.DeletionPayloadType
	DeletionPayload     []byte
	DeletionPayloadId   string
	Identity            crypto.PubKey
	// DeletionTimestamp is ignored when setting in ChangeStatus
	DeletionTimestamp int64
	// ToBeDeletedTimestamp is ignored when setting in ChangeStatus
	ToBeDeletedTimestamp int64
	Status               int
	PeerId               string
	SpaceId              string
	NetworkId            string
}

type StatusEntry

type StatusEntry struct {
	SpaceId              string    `bson:"_id"`
	Identity             string    `bson:"identity"`
	OldIdentity          string    `bson:"oldIdentity"`
	DeletionPayloadType  int       `bson:"deletionPayloadType"`
	DeletionPayload      []byte    `bson:"deletionPayload"`
	DeletionTimestamp    int64     `bson:"deletionTimestamp"`
	ToBeDeletedTimestamp int64     `bson:"toBeDeletedTimestamp"`
	Status               int       `bson:"status"`
	Type                 SpaceType `bson:"type"`
	IsShareable          bool      `bson:"isShareable"`
}

Directories

Path Synopsis
Package mock_spacestatus is a generated GoMock package.
Package mock_spacestatus is a generated GoMock package.

Jump to

Keyboard shortcuts

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