2024-10-27 17:20:10 -03:00
|
|
|
package blossom
|
|
|
|
|
2024-10-27 23:00:51 -03:00
|
|
|
import (
|
|
|
|
"context"
|
2024-10-27 17:20:10 -03:00
|
|
|
|
2024-10-27 23:00:51 -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"`
|
2024-10-27 23:00:51 -03:00
|
|
|
|
2024-10-29 16:32:45 -03:00
|
|
|
Owner string `json:"-"`
|
2024-10-27 17:20:10 -03:00
|
|
|
}
|
2024-10-27 23:00:51 -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)
|