storage

package
v0.0.0-...-bc47110 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const SpendsKey = "spends"

Variables

This section is empty.

Functions

func OutMembershipKey

func OutMembershipKey(topic string) string

func OutputTopicKey

func OutputTopicKey(outpoint *transaction.Outpoint, topic string) string

func TxMembershipKey

func TxMembershipKey(topic string) string

Types

type BSONBeef

type BSONBeef struct {
	Txid   string   `bson:"_id"`
	Beef   []byte   `bson:"beef"`
	Topics []string `bson:"topics"`
}

type BSONOutput

type BSONOutput struct {
	Outpoint string `bson:"outpoint"`
	Txid     string `bson:"txid"`
	Topic    string `bson:"topic"`
	// Script          []byte   `bson:"script"`
	Satoshis        uint64   `bson:"satoshis"`
	Spent           bool     `bson:"spent"`
	OutputsConsumed []string `bson:"outputsConsumed"`
	ConsumedBy      []string `bson:"consumedBy"`
	BlockHeight     uint32   `bson:"blockHeight"`
	BlockIdx        uint64   `bson:"blockIdx"`
	Score           float64  `bson:"score"`
	AncillaryTxids  []string `bson:"ancillaryTxids"`
	AncillaryBeef   []byte   `bson:"ancillaryBeef"`
}

func NewBSONOutput

func NewBSONOutput(o *engine.Output) *BSONOutput

func (*BSONOutput) ToEngineOutput

func (o *BSONOutput) ToEngineOutput() *engine.Output

type MongoStorage

type MongoStorage struct {
	DB        *mongo.Database
	BeefStore beef.BeefStorage
	// contains filtered or unexported fields
}

func NewMongoStorage

func NewMongoStorage(connString string, dbName string, beefStore beef.BeefStorage, pub publish.Publisher) (*MongoStorage, error)

func (*MongoStorage) DeleteOutput

func (s *MongoStorage) DeleteOutput(ctx context.Context, outpoint *transaction.Outpoint, topic string) error

func (*MongoStorage) DoesAppliedTransactionExist

func (s *MongoStorage) DoesAppliedTransactionExist(ctx context.Context, tx *overlay.AppliedTransaction) (bool, error)

func (*MongoStorage) FindOutput

func (s *MongoStorage) FindOutput(ctx context.Context, outpoint *transaction.Outpoint, topic *string, spent *bool, includeBEEF bool) (o *engine.Output, err error)

func (*MongoStorage) FindOutputs

func (s *MongoStorage) FindOutputs(ctx context.Context, outpoints []*transaction.Outpoint, topic string, spent *bool, includeBEEF bool) ([]*engine.Output, error)

func (*MongoStorage) FindOutputsForTransaction

func (s *MongoStorage) FindOutputsForTransaction(ctx context.Context, txid *chainhash.Hash, includeBEEF bool) ([]*engine.Output, error)

func (*MongoStorage) FindUTXOsForTopic

func (s *MongoStorage) FindUTXOsForTopic(ctx context.Context, topic string, since float64, limit uint32, includeBEEF bool) ([]*engine.Output, error)

func (*MongoStorage) GetLastInteraction

func (s *MongoStorage) GetLastInteraction(ctx context.Context, host string, topic string) (float64, error)

func (*MongoStorage) InsertAppliedTransaction

func (s *MongoStorage) InsertAppliedTransaction(ctx context.Context, tx *overlay.AppliedTransaction) error

func (*MongoStorage) InsertOutput

func (s *MongoStorage) InsertOutput(ctx context.Context, utxo *engine.Output) (err error)

func (*MongoStorage) MarkUTXOAsSpent

func (s *MongoStorage) MarkUTXOAsSpent(ctx context.Context, outpoint *transaction.Outpoint, topic string, beef []byte) error

func (*MongoStorage) MarkUTXOsAsSpent

func (s *MongoStorage) MarkUTXOsAsSpent(ctx context.Context, outpoints []*transaction.Outpoint, topic string, spendTxid *chainhash.Hash) error

func (*MongoStorage) UpdateConsumedBy

func (s *MongoStorage) UpdateConsumedBy(ctx context.Context, outpoint *transaction.Outpoint, topic string, consumedBy []*transaction.Outpoint) error

func (*MongoStorage) UpdateLastInteraction

func (s *MongoStorage) UpdateLastInteraction(ctx context.Context, host string, topic string, since float64) error

func (*MongoStorage) UpdateOutputBlockHeight

func (s *MongoStorage) UpdateOutputBlockHeight(ctx context.Context, outpoint *transaction.Outpoint, topic string, blockHeight uint32, blockIndex uint64, ancelliaryBeef []byte) error

func (*MongoStorage) UpdateTransactionBEEF

func (s *MongoStorage) UpdateTransactionBEEF(ctx context.Context, txid *chainhash.Hash, beef []byte) error

type RedisStorage

type RedisStorage struct {
	DB        *redis.Client
	BeefStore beef.BeefStorage
	// contains filtered or unexported fields
}

func NewRedisStorage

func NewRedisStorage(connString string, beefStore beef.BeefStorage, pub publish.Publisher) (r *RedisStorage, err error)

func (*RedisStorage) Close

func (s *RedisStorage) Close() error

func (*RedisStorage) DeleteOutput

func (s *RedisStorage) DeleteOutput(ctx context.Context, outpoint *transaction.Outpoint, topic string) error

func (*RedisStorage) DoesAppliedTransactionExist

func (s *RedisStorage) DoesAppliedTransactionExist(ctx context.Context, tx *overlay.AppliedTransaction) (bool, error)

func (*RedisStorage) FindOutput

func (s *RedisStorage) FindOutput(ctx context.Context, outpoint *transaction.Outpoint, topic *string, spent *bool, includeBEEF bool) (o *engine.Output, err error)

func (*RedisStorage) FindOutputs

func (s *RedisStorage) FindOutputs(ctx context.Context, outpoints []*transaction.Outpoint, topic string, spent *bool, includeBEEF bool) ([]*engine.Output, error)

func (*RedisStorage) FindOutputsForTransaction

func (s *RedisStorage) FindOutputsForTransaction(ctx context.Context, txid *chainhash.Hash, includeBEEF bool) ([]*engine.Output, error)

func (*RedisStorage) FindUTXOsForTopic

func (s *RedisStorage) FindUTXOsForTopic(ctx context.Context, topic string, since uint32, includeBEEF bool) ([]*engine.Output, error)

func (*RedisStorage) InsertAppliedTransaction

func (s *RedisStorage) InsertAppliedTransaction(ctx context.Context, tx *overlay.AppliedTransaction) error

func (*RedisStorage) InsertOutput

func (s *RedisStorage) InsertOutput(ctx context.Context, utxo *engine.Output) (err error)

func (*RedisStorage) MarkUTXOAsSpent

func (s *RedisStorage) MarkUTXOAsSpent(ctx context.Context, outpoint *transaction.Outpoint, topic string, beef []byte) error

func (*RedisStorage) MarkUTXOsAsSpent

func (s *RedisStorage) MarkUTXOsAsSpent(ctx context.Context, outpoints []*transaction.Outpoint, topic string, spendTxid *chainhash.Hash) error

func (*RedisStorage) UpdateConsumedBy

func (s *RedisStorage) UpdateConsumedBy(ctx context.Context, outpoint *transaction.Outpoint, topic string, consumedBy []*transaction.Outpoint) error

func (*RedisStorage) UpdateOutputBlockHeight

func (s *RedisStorage) UpdateOutputBlockHeight(ctx context.Context, outpoint *transaction.Outpoint, topic string, blockHeight uint32, blockIndex uint64, ancelliaryBeef []byte) error

func (*RedisStorage) UpdateTransactionBEEF

func (s *RedisStorage) UpdateTransactionBEEF(ctx context.Context, txid *chainhash.Hash, beef []byte) error

Jump to

Keyboard shortcuts

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