blossom

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

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

Go to latest
Published: Mar 1, 2026 License: Unlicense Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobIndex

type BlobIndex interface {
	Keep(ctx context.Context, blob blossom.BlobDescriptor, pubkey nostr.PubKey) error
	List(ctx context.Context, pubkey nostr.PubKey) iter.Seq[blossom.BlobDescriptor]
	Get(ctx context.Context, sha256 string) (*blossom.BlobDescriptor, error)
	Delete(ctx context.Context, sha256 string, pubkey nostr.PubKey) error
}

type BlossomServer

type BlossomServer struct {
	ServiceURL string
	Store      BlobIndex

	StoreBlob     func(ctx context.Context, sha256 string, ext string, body []byte) error
	LoadBlob      func(ctx context.Context, sha256 string, ext string) (io.ReadSeeker, *url.URL, error)
	DeleteBlob    func(ctx context.Context, sha256 string, ext string) error
	ReceiveReport func(ctx context.Context, reportEvt nostr.Event) error

	RejectUpload func(ctx context.Context, auth *nostr.Event, size int, ext string) (bool, string, int)
	RejectGet    func(ctx context.Context, auth *nostr.Event, sha256 string, ext string) (bool, string, int)
	RejectList   func(ctx context.Context, auth *nostr.Event, pubkey nostr.PubKey) (bool, string, int)
	RejectDelete func(ctx context.Context, auth *nostr.Event, sha256 string, ext string) (bool, string, int)
}

func New

func New(rl *khatru.Relay, serviceURL string) *BlossomServer

type EventStoreBlobIndexWrapper

type EventStoreBlobIndexWrapper struct {
	eventstore.Store

	ServiceURL string
}

EventStoreBlobIndexWrapper uses fake events to keep track of what blobs we have stored and who owns them

func (EventStoreBlobIndexWrapper) Delete

func (es EventStoreBlobIndexWrapper) Delete(ctx context.Context, sha256 string, pubkey nostr.PubKey) error

func (EventStoreBlobIndexWrapper) Get

func (EventStoreBlobIndexWrapper) Keep

func (EventStoreBlobIndexWrapper) List

type MemoryBlobIndex

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

func NewMemoryBlobIndex

func NewMemoryBlobIndex() MemoryBlobIndex

func (MemoryBlobIndex) Delete

func (x MemoryBlobIndex) Delete(ctx context.Context, sha256 string, pubkey nostr.PubKey) error

func (MemoryBlobIndex) Get

func (MemoryBlobIndex) Keep

func (MemoryBlobIndex) List

Jump to

Keyboard shortcuts

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