storage

package
v0.0.0-...-4ff583b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookConfigurationEntry

type HookConfigurationEntry struct {
	bun.BaseModel        `bun:"table:hook_configuration_entry"`
	ID                   string    `bun:"id,pk" json:"id"`
	ConfigurationEntryID string    `bun:"configuration_entry_id" json:"configuration_entry_id"`
	HookRecordID         string    `bun:"hook_record_id" json:"hook_record_id"`
	Message              []byte    `bun:"message" json:"message"`
	CreateDate           time.Time `bun:"create_date" json:"create_date"`
}

type HookRecord

type HookRecord struct {
	bun.BaseModel                   `bun:"table:hook_record"`
	ID                              string    `bun:"id,pk" json:"id"`
	HookRecordID                    string    `bun:"hook_record_id" json:"hook_record_id"`
	CreatorDID                      string    `bun:"creator_did" json:"creator_did"`
	OwnerDID                        string    `bun:"owner_did" json:"owner_did"`
	InitialHookConfigurationEntryID string    `bun:"initial_hook_config_entry_id" json:"initial_hook_config_entry_id"`
	LatestHookConfigurationEntryID  string    `bun:"latest_hook_config_entry_id" json:"latest_hook_config_entry_id"`
	CreateDate                      time.Time `bun:"create_date" json:"create_date"`

	// For Indexing
	FilterDataRecordID    string `bun:"filter_data_record_id" json:"filter_data_record_id"`
	FilterSchema          string `bun:"filter_schema" json:"filter_schema"`
	FilterProtocol        string `bun:"filter_protocol" json:"filter_protocol"`
	FilterProtocolVersion string `bun:"filter_protocol_version" json:"filter_protocol_version"`
}

type HookStore

type HookStore interface {
	GetHookRecord(ctx context.Context, hookRecordId string) (*HookRecord, *HookConfigurationEntry, error)
	GetHookRecordConfigurationEntries(ctx context.Context, hookRecordId string) (*HookRecord, []*HookConfigurationEntry, error)
	CreateHookRecord(ctx context.Context, hookRecord *HookRecord, initialConfiguration *HookConfigurationEntry) error
	UpdateHookRecord(ctx context.Context, hookRecordId string, updatedConfiguration *HookConfigurationEntry) error
	DeleteHookRecord(ctx context.Context, hookRecordId string) error

	FindHookRecordsForDataRecord(ctx context.Context, dataRecordId string) (map[*HookRecord]*HookConfigurationEntry, error)
	FindHookRecordsForSchemaAndProtocol(ctx context.Context, schemaUri string, protocol string, protocolVersion string) (map[*HookRecord]*HookConfigurationEntry, error)

	BeginTx(ctx context.Context) error
	CommitTx(ctx context.Context) error
	RollbackTx(ctx context.Context) error
}

Base interface for storing Hook configuration from the user

type MessageEntry

type MessageEntry struct {
	bun.BaseModel          `bun:"table:message_entry"`
	ID                     string    `bun:"id,pk" json:"id"`
	PreviousMessageEntryID string    `bun:"previous_message_entry_id" json:"previous_message_entry_id"`
	DWNRecordID            string    `bun:"dwn_record_id" json:"record_id"`
	Message                []byte    `bun:"message" json:"message"`
	CreateDate             time.Time `bun:"create_date" json:"create_date"`
}

type Record

type Record struct {
	bun.BaseModel           `bun:"table:record"`
	ID                      string    `bun:"id,pk" json:"id"`
	DWNRecordID             string    `bun:"dwn_record_id" json:"dwn_record_id"`
	CreatorDID              string    `bun:"creator_did" json:"creator_did"`
	OwnerDID                string    `bun:"owner_did" json:"owner_did"`
	WriterDIDs              []string  `bun:"writer_dids,array" json:"writer_dids"`
	ReaderDIDs              []string  `bun:"reader_dids,array" json:"reader_dids"`
	InitialEntryID          string    `bun:"initial_entry_id" json:"initial_entry_id"`
	LatestEntryID           string    `bun:"latest_entry_id" json:"latest_entry_id"`
	LatestCheckpointEntryID string    `bun:"latest_checkpoint_entry_id" json:"latest_checkpoint_entry_id"`
	CreateDate              time.Time `bun:"create_date" json:"create_date"`
}

type RecordStore

type RecordStore interface {

	// Refactored methods here
	CreateRecord(ctx context.Context, record *Record, initialEntry *MessageEntry) error
	SaveRecord(ctx context.Context, record *Record) error

	AddMessageEntry(ctx context.Context, entry *MessageEntry) error
	GetMessageEntryByID(ctx context.Context, messageEntryID string) *MessageEntry
	GetRecord(ctx context.Context, recordId string) *Record
	DeleteMessageEntry(ctx context.Context, entry *MessageEntry) error
	DeleteMessageEntryByID(ctx context.Context, messageEntryId string) error

	BeginTx(ctx context.Context) error
	CommitTx(ctx context.Context) error
	RollbackTx(ctx context.Context) error
}

Base interface for stores for collections Will probably need:

  • methods for finding by content in the collection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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