service

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fatal

func Fatal(err error) bool

Fatal inspects the error and returns whether it's a fatal error

func GetBodyRetry

func GetBodyRetry(url string, nbTries int) ([]byte, error)

GetBodyRetry: simple GET with N retry in case of temporary errors

func HTTPGetWithAuth added in v1.0.0

func HTTPGetWithAuth(ctx context.Context, url, authName, authPswd, authToken string) ([]byte, error)

func HTTPPostWithAuth added in v1.0.0

func HTTPPostWithAuth(ctx context.Context, url string, body io.Reader, authName, authPswd, authToken string) (*http.Response, error)

func LayerFileName

func LayerFileName(tile common.Tile, layer Layer, ext Extension) string

LayerFileName returns the name of the file given the tile, the layer and the extension

func MakeFatal

func MakeFatal(err error) error

func MakeTemporary

func MakeTemporary(err error) error

func MergeErrors

func MergeErrors(priorityToError bool, err error, newErrs ...error) error

MergeErrors, appending texts if priorityToErr is true, priority to the fatal error then to the temporary else, priority to no error, then to the temporary and finally to the fatal error.

func NewGeocubeClient

func NewGeocubeClient(ctx context.Context, geocubeServer, apikey string, tlsConfig *tls.Config) (*geocube.Client, error)

NewGeocubeClient connects to the Geocube and returns a client

func Temporary

func Temporary(err error) bool

Temporary inspects the error trace and returns whether the error is transient

func ToJSON added in v1.0.0

func ToJSON(v interface{}, workingdir, filename string) error

func UnmarshalGeometry

func UnmarshalGeometry(data []byte) (_ geom.Geometry, err error)

UnmarshalGeometry, merging featureCollections and geometryCollections into a multipolygon

Types

type ErrFileNotFound

type ErrFileNotFound struct {
	File string
}

ErrFileNotFound is an error returned by ImportLayer or DeleteLayer

func (ErrFileNotFound) Error

func (e ErrFileNotFound) Error() string

type Extension

type Extension string

Extension of a layer

const (
	ExtensionGTiff Extension = "tif"
	// The following extensions are exported as zip file
	ExtensionZIP       Extension = "zip"
	ExtensionSAFE      Extension = "SAFE"
	ExtensionDIMAP     Extension = "dim"
	ExtensionDIMAPData Extension = "data"
	ExtensionAll       Extension = "all"
)

List of supported extension

type Layer

type Layer string

Layer of an image

const (
	Product Layer = "product"

	LayerPreprocessed  Layer = "preprocessed"
	LayerCoregistrated Layer = "coregistred"
	LayerCoregExtract  Layer = "coregextract"
	LayerCoherence     Layer = "coherence"

	LayerBackscatterVV Layer = "sigma0_VV"
	LayerBackscatterVH Layer = "sigma0_VH"
	LayerCoherenceVV   Layer = "coh_VV"
	LayerCoherenceVH   Layer = "coh_VH"
	LayerPanchromatic  Layer = "P"
	LayerMultiSpectral Layer = "MS"
)

List of available layers

type Storage

type Storage interface {
	// SaveLayer persists the layer into a storage and returns the uri
	SaveLayer(ctx context.Context, tile common.Tile, layer Layer, ext Extension, localdir string) (string, error)
	// ImportLayer imports the layer from the storage to the given localdir
	// Raise ErrFileNotFound
	ImportLayer(ctx context.Context, tile common.Tile, layer Layer, ext Extension, localdir string) error
	// DeleteLayer delete the layer from the storage
	// Raise ErrFileNotFound
	DeleteLayer(ctx context.Context, tile common.Tile, layer Layer, ext Extension) error
}

Storage is a service to store and retrieve file from storage

type StorageStrategy

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

StorageStrategy implements Storage using geocube.Strategy

func NewStorageStrategy

func NewStorageStrategy(ctx context.Context, storageURI string) (*StorageStrategy, error)

NewStorageStrategy creates a new StorageStrategy

func (*StorageStrategy) DeleteLayer

func (ss *StorageStrategy) DeleteLayer(ctx context.Context, tile common.Tile, layer Layer, ext Extension) error

DeleteLayer implements Storage

func (*StorageStrategy) ImportLayer

func (ss *StorageStrategy) ImportLayer(ctx context.Context, tile common.Tile, layer Layer, ext Extension, localdir string) error

ImportLayer implements Storage

func (*StorageStrategy) SaveLayer

func (ss *StorageStrategy) SaveLayer(ctx context.Context, tile common.Tile, layer Layer, ext Extension, localdir string) (string, error)

SaveLayer implements Storage

type StringSet

type StringSet map[string]struct{}

StringSet is a set of strings (all elements are unique)

func (StringSet) Exists

func (ss StringSet) Exists(s string) bool

Exists returns true if the string already exists in the Set

func (StringSet) Pop

func (ss StringSet) Pop(s string)

Pop removes the string from the set

func (StringSet) Push

func (ss StringSet) Push(s string)

Push adds the string to the set if not already exists

func (StringSet) Slice

func (ss StringSet) Slice() []string

Slice returns a slice from the set

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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