Documentation
¶
Index ¶
- type BlobIndex
- type BlossomServer
- type EventStoreBlobIndexWrapper
- func (es EventStoreBlobIndexWrapper) Delete(ctx context.Context, sha256 string, pubkey nostr.PubKey) error
- func (es EventStoreBlobIndexWrapper) Get(ctx context.Context, sha256 string) (*blossom.BlobDescriptor, error)
- func (es EventStoreBlobIndexWrapper) Keep(ctx context.Context, blob blossom.BlobDescriptor, pubkey nostr.PubKey) error
- func (es EventStoreBlobIndexWrapper) List(ctx context.Context, pubkey nostr.PubKey) iter.Seq[blossom.BlobDescriptor]
- type MemoryBlobIndex
- func (x MemoryBlobIndex) Delete(ctx context.Context, sha256 string, pubkey nostr.PubKey) error
- func (x MemoryBlobIndex) Get(ctx context.Context, sha256 string) (*blossom.BlobDescriptor, error)
- func (x MemoryBlobIndex) Keep(ctx context.Context, blob blossom.BlobDescriptor, pubkey nostr.PubKey) error
- func (x MemoryBlobIndex) List(ctx context.Context, pubkey nostr.PubKey) iter.Seq[blossom.BlobDescriptor]
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)
}
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) Get ¶
func (es EventStoreBlobIndexWrapper) Get(ctx context.Context, sha256 string) (*blossom.BlobDescriptor, error)
func (EventStoreBlobIndexWrapper) Keep ¶
func (es EventStoreBlobIndexWrapper) Keep( ctx context.Context, blob blossom.BlobDescriptor, pubkey nostr.PubKey, ) error
type MemoryBlobIndex ¶
type MemoryBlobIndex struct {
// contains filtered or unexported fields
}
func NewMemoryBlobIndex ¶
func NewMemoryBlobIndex() MemoryBlobIndex
func (MemoryBlobIndex) Get ¶
func (x MemoryBlobIndex) Get(ctx context.Context, sha256 string) (*blossom.BlobDescriptor, error)
func (MemoryBlobIndex) Keep ¶
func (x MemoryBlobIndex) Keep(ctx context.Context, blob blossom.BlobDescriptor, pubkey nostr.PubKey) error
Click to show internal directories.
Click to hide internal directories.