catalog

package
v0.0.0-...-d7fa2ca Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(authorization string) (bool, string)

Authenticate returns true and a token if the authorization string is valid

func Authorize

func Authorize(token, role string) bool

Authorize returns true if the token is authorized to perform the role provided

func DeleteRecurring

func DeleteRecurring(key string) error

DeleteRecurring removes all trace of a recurring harvest from storage

func DropIndex

func DropIndex() int

DropIndex drops the main index containing all known catalog entries, deletes the underlying entries, and returns the number of images

func GetKey

func GetKey(key string) (string, error)

GetKey shouldn't exist. It is a hack to provide convenient persistence.

func GetMockConnCount

func GetMockConnCount() (count int)

GetMockConnCount returns mockConnCount

func GetSceneMetadata

func GetSceneMetadata(id string) (*geojson.Feature, error)

GetSceneMetadata returns the image metadata as a GeoJSON feature

func HarvestPlanet

func HarvestPlanet(options HarvestOptions)

HarvestPlanet harvests Planet Labs

func IndexSize

func IndexSize() int64

IndexSize returns the size of the index

func MakeMockRedisCli

func MakeMockRedisCli(outputs []string) *redis.Client

MakeMockRedisCli creates the mock redis client

func MockDialer

func MockDialer() (net.Conn, error)

MockDialer sets up a mock dialer for the mock redis

func PlanetRecurring

func PlanetRecurring(host string, options HarvestOptions) (string, string, error)

PlanetRecurring establishes the workflow management for a recurring harvest and returns the event ID and trigger ID

func RedisClient

func RedisClient() (*redis.Client, error)

RedisClient is a factory method for a Redis instance

func RedisConvArray

func RedisConvArray() string

RedisConvArray returns a specific string for testing purposes

func RedisConvErrStr

func RedisConvErrStr(val string) string

RedisConvErrStr converts an error string for redis use

func RedisConvInt

func RedisConvInt(val int) string

RedisConvInt converts an int for redis use

func RedisConvStatus

func RedisConvStatus(val string) string

RedisConvStatus converts a status string for redis use

func RedisConvString

func RedisConvString(val string) string

RedisConvString converts a string for redis use

func RedisError

func RedisError(red *redis.Client, err error)

RedisError closes down the connection so that other operations can fail somewhat gracefully. We should never fail in normal settings.

func RemoveFeature

func RemoveFeature(feature *geojson.Feature) error

RemoveFeature removes a feature from the catalog and any known caches

func SaveFeatureProperties

func SaveFeatureProperties(id string, properties map[string]interface{}) error

SaveFeatureProperties retrieves the requested feature from the database, Updates properties with the contents of the map provided, and re-saves

func SetIDAM

func SetIDAM(idam IDAM)

SetIDAM sets the IDAM for this application

func SetImageCatalogPrefix

func SetImageCatalogPrefix(prefix string)

SetImageCatalogPrefix sets the prefix for this instance when it is necessary to override the default

func SetKey

func SetKey(key, value string) error

SetKey shouldn't exist. It is a hack to provide convenient persistence.

func SetMockConnCount

func SetMockConnCount(count int)

SetMockConnCount sets mockConnCount

func StoreFeature

func StoreFeature(feature *geojson.Feature, reharvest bool) (string, error)

StoreFeature stores a feature into the catalog using a key based on the feature's ID

func StoreRecurring

func StoreRecurring(key string, options HarvestOptions) error

StoreRecurring adds the details of a recurring harvest to storage for later retrieval

Types

type FeatureLayer

type FeatureLayer struct {
	WfsURL      string                    `json:"wfsurl"`
	FeatureType string                    `json:"featureType"`
	GeoJSON     map[string]interface{}    `json:"geojson"`
	TileMap     map[string]*geos.Geometry `json:"-"`
}

FeatureLayer describes features

func (*FeatureLayer) Disjoint

func (fl *FeatureLayer) Disjoint(input *geos.Geometry) (bool, error)

Disjoint returns true if the layer is disjoint with the geometry provided

func (*FeatureLayer) Intersects

func (fl *FeatureLayer) Intersects(input *geos.Geometry) (bool, error)

Intersects returns true if the layer is disjoint with the geometry provided

func (*FeatureLayer) PrepareGeometries

func (fl *FeatureLayer) PrepareGeometries() error

PrepareGeometries establishes Geos geometries for later processing, Returning an error on failure

type HarvestFilter

type HarvestFilter struct {
	WhiteList FeatureLayer `json:"whitelist"`
	BlackList FeatureLayer `json:"blacklist"`
}

HarvestFilter constrains harvesting

func (*HarvestFilter) PrepareGeometries

func (hf *HarvestFilter) PrepareGeometries() error

PrepareGeometries establishes Geos geometries for later processing, Returning an error on failure

type HarvestOptions

type HarvestOptions struct {
	Event               bool          `json:"event,omitempty"`
	Reharvest           bool          `json:"reharvest,omitempty"`
	PlanetKey           string        `json:"PL_API_KEY"`
	PiazzaGateway       string        `json:"pzGateway"`
	PiazzaAuthorization string        `json:"pzAuth"`
	Filter              HarvestFilter `json:"filter"`
	Cap                 int           `json:"cap"`
	URLRoot             string        `json:"urlRoot"`
	Recurring           bool          `json:"recurring"`
	RequestPageSize     int           `json:"requestPageSize"`

	EventTypeID string
	// contains filtered or unexported fields
}

HarvestOptions are options for a harvesting operation

type IDAM

type IDAM interface {
	// contains filtered or unexported methods
}

IDAM is an interface for providing authentication and authorization

type PlanetLinks struct {
	Self  string `json:"self"`
	Prev  string `json:"prev"`
	Next  string `json:"next"`
	First string `json:"first"`
}

PlanetLinks represents the links JSON structure.

type PlanetResponse

type PlanetResponse struct {
	Count string      `json:"auth"`
	Links PlanetLinks `json:"links"`
}

PlanetResponse represents the response JSON structure.

type SceneDescriptors

type SceneDescriptors struct {
	Count      int                        `json:"count"`
	TotalCount int                        `json:"totalCount"`
	StartIndex int                        `json:"startIndex"`
	SubIndex   string                     `json:"subIndex"`
	Scenes     *geojson.FeatureCollection `json:"images"` // Changing this to "scenes" may break clients
}

SceneDescriptors is the response to a Discover query

func GetScenes

func GetScenes(input *geojson.Feature, options SearchOptions) (SceneDescriptors, string, error)

GetScenes returns scenes for the given set matching the criteria in the input and options

type SearchOptions

type SearchOptions struct {
	NoCache      bool
	MinimumIndex int
	MaximumIndex int
	Count        int
	Rigorous     bool
}

SearchOptions is the options for a search request

type TestIDAM

type TestIDAM struct {
}

TestIDAM is an IDAM solely for testing purposes. Very permissive. TODO: Move to a test file once we have a real test solution to use

type VcapCredentials

type VcapCredentials struct {
	Host     string `json:"host"`
	Password string `json:"password"`
	Port     int    `json:"port"`
}

VcapCredentials is the credentials element of VCAP_SERVICES

type VcapRedis

type VcapRedis struct {
	// Label       string          `json:"label"`
	// Name        string          `json:"name"`
	// Plan        string          `json:"plan"`
	// Tags        []string        `json:"tags"`
	Credentials VcapCredentials `json:"credentials"`
}

VcapRedis is the p-redis element of VCAP_SERVICES

type VcapServices

type VcapServices struct {
	Redis []VcapRedis `json:"p-redis"`
}

VcapServices is the container for the VCAP_SERVICES environment variable

func (VcapServices) RedisOptions

func (services VcapServices) RedisOptions() *redis.Options

RedisOptions is a factory method for redis.Options If the object is not complete, a default of 127.0.0.1:6379 is returned

Jump to

Keyboard shortcuts

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