mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-22 19:19:18 -05:00
2404eff48e
* experimental search backport fix basic extractor resource name move escapeQuery regex into global variable minor pr review changes rename DebounceDuration env variable add document title and content when rebuilding bleve resource Co-authored-by: David Christofas <dchristofas@owncloud.com>
32 lines
686 B
Go
32 lines
686 B
Go
package content
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
|
"google.golang.org/grpc/metadata"
|
|
)
|
|
|
|
// Retriever is the interface that wraps the basic Retrieve method. 🐕
|
|
// It requests and then returns a resource from the underlying storage.
|
|
//
|
|
//go:generate mockery --name=Retriever
|
|
type Retriever interface {
|
|
Retrieve(ctx context.Context, rID *provider.ResourceId) (io.ReadCloser, error)
|
|
}
|
|
|
|
func contextGet(ctx context.Context, k string) (string, bool) {
|
|
md, ok := metadata.FromOutgoingContext(ctx)
|
|
if !ok {
|
|
return "", false
|
|
}
|
|
|
|
token, ok := md[k]
|
|
if len(token) == 0 || !ok {
|
|
return "", false
|
|
}
|
|
|
|
return token[0], ok
|
|
}
|