spacego

package module
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 12

README

spacego

This is a Go implementation of S P A C E - secure, private, storage.

Build

go build

Documentation

Index

Constants

View Source
const (
	SPACE              = "S P A C E"
	SPACE_CHARGE       = "Space-Charge"
	SPACE_INVOICE      = "Space-Invoice"
	SPACE_REGISTRAR    = "Space-Registrar"
	SPACE_REGISTRATION = "Space-Registration"
	SPACE_SUBSCRIPTION = "Space-Subscription"
	SPACE_USAGE_RECORD = "Space-Usage-Record"

	SPACE_PREFIX            = "Space-"
	SPACE_PREFIX_DELTA      = "Space-Delta-"
	SPACE_PREFIX_META       = "Space-Meta-"
	SPACE_PREFIX_PREVIEW    = "Space-Preview-"
	SPACE_PREFIX_TAG        = "Space-Tag-"
	SPACE_PREFIX_VALIDATION = "Space-Validation-"

	THRESHOLD_ACCOUNTING = bcgo.THRESHOLD_G // Charge, Invoice, Registrar, Registration, Subscription, Usage Record Channels
	THRESHOLD_CUSTOMER   = bcgo.THRESHOLD_Z // Delta, Meta, Preview, Tag Channels
	THRESHOLD_VALIDATION = validation.THRESHOLD_PERIOD_DAY

	PERIOD_VALIDATION = validation.PERIOD_DAILY

	MIME_TYPE_UNKNOWN    = "?/?"
	MIME_TYPE_IMAGE_JPEG = "image/jpeg"
	MIME_TYPE_IMAGE_JPG  = "image/jpg"
	MIME_TYPE_IMAGE_GIF  = "image/gif"
	MIME_TYPE_IMAGE_PNG  = "image/png"
	MIME_TYPE_IMAGE_WEBP = "image/webp"
	MIME_TYPE_TEXT_PLAIN = "text/plain"
	MIME_TYPE_PDF        = "application/pdf"
	MIME_TYPE_PROTOBUF   = "application/x-protobuf"
	MIME_TYPE_VIDEO_MPEG = "video/mpeg"
	MIME_TYPE_AUDIO_MPEG = "audio/mpeg"

	MIME_TYPE_IMAGE_DEFAULT = "image/jpeg"
	MIME_TYPE_VIDEO_DEFAULT = "video/mpeg"
	MIME_TYPE_AUDIO_DEFAULT = "audio/mpeg"

	PREVIEW_IMAGE_SIZE  = 128
	PREVIEW_TEXT_LENGTH = 64

	MAX_SIZE_BYTES = bcgo.MAX_PAYLOAD_SIZE_BYTES - 1024 // 10Mb-1Kb (for delta protobuf stuff)
)

Variables

This section is empty.

Functions

func AllRegistrars added in v1.2.0

func AllRegistrars(node bcgo.Node, callback RegistrarCallback) error

AllRegistrars triggers the given callback for each registrar.

func AllRegistrarsForNode added in v1.2.0

func AllRegistrarsForNode(node bcgo.Node, callback func(*Registrar, *financego.Registration, *financego.Subscription) error) error

AllRegistrarsForNode triggers the given callback for each registrar with which the given node is registered, and optionally subscribed

func AllRegistrationsForNode added in v1.2.0

func AllRegistrationsForNode(node bcgo.Node, callback financego.RegistrationCallback) error

AllRegistrationsForNode triggers the given callback for each registration.

func AllSubscriptionsForNode added in v1.2.0

func AllSubscriptionsForNode(node bcgo.Node, callback financego.SubscriptionCallback) error

AllSubscriptionsForNode triggers the given callback for each subscription.

func ApplyDelta

func ApplyDelta(delta *Delta, input []byte) []byte

func CreateDeltas

func CreateDeltas(reader io.Reader, max uint64, callback func(*Delta) error) error

func DeltaChannelName added in v1.2.0

func DeltaChannelName(metaId string) string

func IterateDeltas

func IterateDeltas(node bcgo.Node, deltas bcgo.Channel, callback DeltaCallback) error

func MetaChannelName added in v1.2.0

func MetaChannelName(alias string) string

func MimeTypes added in v1.2.0

func MimeTypes() []string

func MinimumRegistrars added in v1.2.0

func MinimumRegistrars() int

func NewCloser added in v1.2.3

func NewCloser(writer io.Writer, closer func() error) io.WriteCloser

func OpenChargeChannel

func OpenChargeChannel() bcgo.Channel

func OpenDeltaChannel

func OpenDeltaChannel(metaId string) bcgo.Channel

func OpenInvoiceChannel

func OpenInvoiceChannel() bcgo.Channel

func OpenMetaChannel

func OpenMetaChannel(alias string) bcgo.Channel

func OpenPreviewChannel

func OpenPreviewChannel(metaId string) bcgo.Channel

func OpenRegistrarChannel

func OpenRegistrarChannel() bcgo.Channel

func OpenRegistrationChannel

func OpenRegistrationChannel() bcgo.Channel

func OpenSubscriptionChannel

func OpenSubscriptionChannel() bcgo.Channel

func OpenTagChannel

func OpenTagChannel(metaId string) bcgo.Channel

func OpenUsageRecordChannel

func OpenUsageRecordChannel() bcgo.Channel

func OpenValidationChannel added in v1.1.7

func OpenValidationChannel(alias string) bcgo.Channel

func PreviewChannelName added in v1.2.0

func PreviewChannelName(metaId string) string

func ReadDelta added in v1.2.0

func ReadDelta(deltas bcgo.Channel, cache bcgo.Cache, network bcgo.Network, account bcgo.Account, recordHash []byte, callback DeltaCallback) error

func ReadMeta added in v1.2.0

func ReadMeta(metas bcgo.Channel, cache bcgo.Cache, network bcgo.Network, account bcgo.Account, recordHash []byte, callback MetaCallback) error

func ReadPreview added in v1.2.0

func ReadPreview(previews bcgo.Channel, cache bcgo.Cache, network bcgo.Network, account bcgo.Account, recordHash []byte, callback PreviewCallback) error

func ReadTag added in v1.2.0

func ReadTag(tags bcgo.Channel, cache bcgo.Cache, network bcgo.Network, account bcgo.Account, recordHash []byte, callback TagCallback) error

func SpaceHosts added in v1.2.0

func SpaceHosts() []string

func TagChannelName added in v1.2.0

func TagChannelName(metaId string) string

func Threshold added in v1.2.0

func Threshold(channel string) uint64

func ValidationChannelName added in v1.2.0

func ValidationChannelName(alias string) string

func Validator added in v1.2.0

func Validator(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) validation.Periodic

Types

type Closer added in v1.2.3

type Closer struct {
	// contains filtered or unexported fields
}

func (*Closer) Close added in v1.2.3

func (c *Closer) Close() error

func (*Closer) Write added in v1.2.3

func (c *Closer) Write(p []byte) (n int, err error)

type Delta

type Delta struct {
	// File Offset.
	Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
	// Number of Bytes Deleted.
	Delete uint64 `protobuf:"varint,2,opt,name=delete,proto3" json:"delete,omitempty"`
	// Bytes Inserted.
	Insert               []byte   `protobuf:"bytes,3,opt,name=insert,proto3" json:"insert,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func Compact added in v1.2.3

func Compact(deltas []*Delta) (results []*Delta)

Compact combines deltas with same offset or consecutive deletes.

func Difference added in v1.2.3

func Difference(a, b []byte) []*Delta

Difference returns a sequence of deltas that transform the first of the given byte arrays into the second.

func (*Delta) Descriptor

func (*Delta) Descriptor() ([]byte, []int)

func (*Delta) GetDelete

func (m *Delta) GetDelete() uint64

func (*Delta) GetInsert

func (m *Delta) GetInsert() []byte

func (*Delta) GetOffset

func (m *Delta) GetOffset() uint64

func (*Delta) ProtoMessage

func (*Delta) ProtoMessage()

func (*Delta) Reset

func (m *Delta) Reset()

func (*Delta) String

func (m *Delta) String() string

func (*Delta) XXX_DiscardUnknown

func (m *Delta) XXX_DiscardUnknown()

func (*Delta) XXX_Marshal

func (m *Delta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Delta) XXX_Merge

func (m *Delta) XXX_Merge(src proto.Message)

func (*Delta) XXX_Size

func (m *Delta) XXX_Size() int

func (*Delta) XXX_Unmarshal

func (m *Delta) XXX_Unmarshal(b []byte) error

type DeltaCallback

type DeltaCallback func(*bcgo.BlockEntry, *Delta) error

type Meta

type Meta struct {
	// Name of file.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// MIME type of file.
	Type                 string   `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Meta) Descriptor

func (*Meta) Descriptor() ([]byte, []int)

func (*Meta) GetName

func (m *Meta) GetName() string

func (*Meta) GetType

func (m *Meta) GetType() string

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) Reset

func (m *Meta) Reset()

func (*Meta) String

func (m *Meta) String() string

func (*Meta) XXX_DiscardUnknown

func (m *Meta) XXX_DiscardUnknown()

func (*Meta) XXX_Marshal

func (m *Meta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Meta) XXX_Merge

func (m *Meta) XXX_Merge(src proto.Message)

func (*Meta) XXX_Size

func (m *Meta) XXX_Size() int

func (*Meta) XXX_Unmarshal

func (m *Meta) XXX_Unmarshal(b []byte) error

type MetaCallback

type MetaCallback func(*bcgo.BlockEntry, *Meta) error

type MetaFilter added in v1.2.3

type MetaFilter interface {
	Filter(*Meta) bool
}

func NewNameFilter added in v1.2.3

func NewNameFilter(names ...string) MetaFilter

func NewTypeFilter added in v1.2.3

func NewTypeFilter(types ...string) MetaFilter

type Preview

type Preview struct {
	// MIME type of preview
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Preview data
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// Preview width
	Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
	// Preview height
	Height               uint32   `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Preview) Descriptor

func (*Preview) Descriptor() ([]byte, []int)

func (*Preview) GetData

func (m *Preview) GetData() []byte

func (*Preview) GetHeight

func (m *Preview) GetHeight() uint32

func (*Preview) GetType

func (m *Preview) GetType() string

func (*Preview) GetWidth

func (m *Preview) GetWidth() uint32

func (*Preview) ProtoMessage

func (*Preview) ProtoMessage()

func (*Preview) Reset

func (m *Preview) Reset()

func (*Preview) String

func (m *Preview) String() string

func (*Preview) XXX_DiscardUnknown

func (m *Preview) XXX_DiscardUnknown()

func (*Preview) XXX_Marshal

func (m *Preview) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Preview) XXX_Merge

func (m *Preview) XXX_Merge(src proto.Message)

func (*Preview) XXX_Size

func (m *Preview) XXX_Size() int

func (*Preview) XXX_Unmarshal

func (m *Preview) XXX_Unmarshal(b []byte) error

type PreviewCallback

type PreviewCallback func(*bcgo.BlockEntry, *Preview) error

type Registrar

type Registrar struct {
	Merchant             *financego.Merchant `protobuf:"bytes,1,opt,name=merchant,proto3" json:"merchant,omitempty"`
	Service              *financego.Service  `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

func RegistrarForAlias added in v1.2.0

func RegistrarForAlias(registrars bcgo.Channel, cache bcgo.Cache, network bcgo.Network, alias string) (*Registrar, error)

func (*Registrar) Descriptor

func (*Registrar) Descriptor() ([]byte, []int)

func (*Registrar) GetMerchant

func (m *Registrar) GetMerchant() *financego.Merchant

func (*Registrar) GetService

func (m *Registrar) GetService() *financego.Service

func (*Registrar) ProtoMessage

func (*Registrar) ProtoMessage()

func (*Registrar) Reset

func (m *Registrar) Reset()

func (*Registrar) String

func (m *Registrar) String() string

func (*Registrar) XXX_DiscardUnknown

func (m *Registrar) XXX_DiscardUnknown()

func (*Registrar) XXX_Marshal

func (m *Registrar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Registrar) XXX_Merge

func (m *Registrar) XXX_Merge(src proto.Message)

func (*Registrar) XXX_Size

func (m *Registrar) XXX_Size() int

func (*Registrar) XXX_Unmarshal

func (m *Registrar) XXX_Unmarshal(b []byte) error

type RegistrarCallback

type RegistrarCallback func(*bcgo.BlockEntry, *Registrar) error

type Tag

type Tag struct {
	// The value of tag applied to meta
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// The reason for tagging
	Reason               string   `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Tag) Descriptor

func (*Tag) Descriptor() ([]byte, []int)

func (*Tag) GetReason

func (m *Tag) GetReason() string

func (*Tag) GetValue

func (m *Tag) GetValue() string

func (*Tag) ProtoMessage

func (*Tag) ProtoMessage()

func (*Tag) Reset

func (m *Tag) Reset()

func (*Tag) String

func (m *Tag) String() string

func (*Tag) XXX_DiscardUnknown

func (m *Tag) XXX_DiscardUnknown()

func (*Tag) XXX_Marshal

func (m *Tag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Tag) XXX_Merge

func (m *Tag) XXX_Merge(src proto.Message)

func (*Tag) XXX_Size

func (m *Tag) XXX_Size() int

func (*Tag) XXX_Unmarshal

func (m *Tag) XXX_Unmarshal(b []byte) error

type TagCallback

type TagCallback func(*bcgo.BlockEntry, *Tag) error

type TagFilter added in v1.2.3

type TagFilter interface {
	Filter(*Tag) bool
}

func NewTagFilter added in v1.2.3

func NewTagFilter(tags ...string) TagFilter

Jump to

Keyboard shortcuts

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