sakuin

package module
v0.0.0-...-a0f6d8d Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 16 Imported by: 0

README

sakuin

Documentation

Overview

Package sakuin

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingBoundary = errors.New("missing boundary")

ErrMissingBoundary represents a boundary value missing in a multipart form body.

Functions

func ReadParts

func ReadParts(r io.Reader, contentType string) (metadata json.RawMessage, object []byte, err error)

ReadParts

func RunDocumentStorageTests

func RunDocumentStorageTests(t TestingT, docStore DocumentStore)

func RunObjectStorageTests

func RunObjectStorageTests(t TestingT, objStore ObjectStore)

Types

type Config

type Config struct {
	ObjectStore   ObjectStore
	DocumentStore DocumentStore
	RandSrc       io.Reader
}

type ContentTypeError

type ContentTypeError struct {
	ContentType string
}

func (ContentTypeError) Error

func (e ContentTypeError) Error() string

type DocumentDoesNotExistErr

type DocumentDoesNotExistErr struct {
	ID string
}

func (DocumentDoesNotExistErr) Error

func (e DocumentDoesNotExistErr) Error() string

type DocumentStore

type DocumentStore interface {
	Stat(ctx context.Context, id string) (*StatInfo, error)
	Get(ctx context.Context, id string) (map[string]interface{}, error)
	Upsert(ctx context.Context, id string, b map[string]interface{}) error
}

type InMemoryDocumentStore

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

func NewInMemoryDocumentStore

func NewInMemoryDocumentStore() *InMemoryDocumentStore

func (*InMemoryDocumentStore) Get

func (s *InMemoryDocumentStore) Get(ctx context.Context, id string) (map[string]interface{}, error)

func (*InMemoryDocumentStore) NumOfDocs

func (s *InMemoryDocumentStore) NumOfDocs() int

func (*InMemoryDocumentStore) Stat

func (*InMemoryDocumentStore) Upsert

func (s *InMemoryDocumentStore) Upsert(ctx context.Context, id string, doc map[string]interface{}) error

func (*InMemoryDocumentStore) WithDocument

func (s *InMemoryDocumentStore) WithDocument(id string, doc map[string]interface{}) *InMemoryDocumentStore

type InMemoryObjectStore

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

func NewInMemoryObjectStore

func NewInMemoryObjectStore() *InMemoryObjectStore

func (*InMemoryObjectStore) Get

func (s *InMemoryObjectStore) Get(ctx context.Context, id string) ([]byte, error)

func (*InMemoryObjectStore) NumOfObects

func (s *InMemoryObjectStore) NumOfObects() int

func (*InMemoryObjectStore) Put

func (s *InMemoryObjectStore) Put(ctx context.Context, id string, b []byte) error

func (*InMemoryObjectStore) Stat

func (s *InMemoryObjectStore) Stat(ctx context.Context, id string) (*StatInfo, error)

func (*InMemoryObjectStore) Update

func (s *InMemoryObjectStore) Update(ctx context.Context, id string, b []byte) error

func (*InMemoryObjectStore) WithObject

func (s *InMemoryObjectStore) WithObject(id string, obj []byte) *InMemoryObjectStore

type ObjectDoesNotExistErr

type ObjectDoesNotExistErr struct {
	ID string
}

func (ObjectDoesNotExistErr) Error

func (e ObjectDoesNotExistErr) Error() string

type ObjectStore

type ObjectStore interface {
	Stat(ctx context.Context, id string) (*StatInfo, error)
	Get(ctx context.Context, id string) ([]byte, error)
	Put(ctx context.Context, id string, b []byte) error
	Update(ctx context.Context, id string, b []byte) error
}

type Service

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

func New

func New(cfg Config) *Service

func (*Service) GetMetadata

func (s *Service) GetMetadata(ctx context.Context, req *pb.GetMetadataRequest) (*pb.GetMetadataResponse, error)

func (*Service) GetObject

func (s *Service) GetObject(ctx context.Context, req *pb.GetObjectRequest) (*pb.GetObjectResponse, error)

func (*Service) Index

func (s *Service) Index(ctx context.Context, req *pb.IndexRequest) (*pb.IndexResponse, error)

func (*Service) UpdateMetadata

func (s *Service) UpdateMetadata(ctx context.Context, req *pb.UpdateMetadataRequest) (*pb.UpdateMetadataResponse, error)

func (*Service) UpdateObject

func (s *Service) UpdateObject(ctx context.Context, req *pb.UpdateObjectRequest) (*pb.UpdateObjectResponse, error)

type StatInfo

type StatInfo struct {
	Exists bool
	Size   int
}

type TestingT

type TestingT interface {
	assert.TestingT
	Run(name string, f func(TestingT))
}

Directories

Path Synopsis
cmd
Package http
Package http
middleware/logger
Package logger
Package logger

Jump to

Keyboard shortcuts

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