khatru/blossom/blob.go

27 lines
689 B
Go
Raw Normal View History

2024-10-27 17:20:10 -03:00
package blossom
import (
"context"
2024-10-27 17:20:10 -03:00
"github.com/nbd-wtf/go-nostr"
)
type BlobDescriptor struct {
2024-10-27 17:20:10 -03:00
URL string `json:"url"`
SHA256 string `json:"sha256"`
Size int `json:"size"`
Type string `json:"type"`
Uploaded nostr.Timestamp `json:"uploaded"`
Owner string `json:"-"`
2024-10-27 17:20:10 -03:00
}
type BlobIndex interface {
Keep(ctx context.Context, blob BlobDescriptor, pubkey string) error
List(ctx context.Context, pubkey string) (chan BlobDescriptor, error)
Get(ctx context.Context, sha256 string) (*BlobDescriptor, error)
Delete(ctx context.Context, sha256 string, pubkey string) error
}
var _ BlobIndex = (*EventStoreBlobIndexWrapper)(nil)