geocube

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NO_OVERVIEW                = 0
	OVERVIEWS_DEFAULT_MIN_SIZE = -1
)
View Source
const (
	DetailNotFoundEntity               = 0
	DetailNotFoundKeyID                = 1
	DetailNotFoundID                   = 2
	DetailAlreadyExistsEntity          = 0
	DetailAlreadyExistsKeyID           = 1
	DetailAlreadyExistsID              = 2
	DetailDependencyStillExistsEntity1 = 0
	DetailDependencyStillExistsEntity2 = 1
	DetailDependencyStillExistsKeyID   = 2
	DetailDependencyStillExistsID      = 3
)

Access details

Variables

This section is empty.

Functions

func CompressionStrings added in v0.5.1

func CompressionStrings() []string

CompressionStrings returns a slice of all String values of the enum

func DTypeStrings added in v0.5.1

func DTypeStrings() []string

DTypeStrings returns a slice of all String values of the enum

func DatasetStatusStrings added in v0.5.1

func DatasetStatusStrings() []string

DatasetStatusStrings returns a slice of all String values of the enum

func GDALURI added in v0.4.0

func GDALURI(uri, subdir string) string

func IsError

func IsError(err error, code ErrorCode) bool

IsError tests whether error is a GeocubeError

func JobStateStrings added in v0.5.1

func JobStateStrings() []string

JobStateStrings returns a slice of all String values of the enum

func JobStatusStrings added in v0.5.1

func JobStatusStrings() []string

JobStatusStrings returns a slice of all String values of the enum

func JobTypeStrings added in v0.5.1

func JobTypeStrings() []string

JobTypeStrings returns a slice of all String values of the enum

func MarshalConsolidationEvent

func MarshalConsolidationEvent(evt ConsolidationEvent) ([]byte, error)

MarshalConsolidationEvent is used to send a ConsolidationEvent over pubsub

func MarshalEvent

func MarshalEvent(evt Event) ([]byte, error)

MarshalEvent returns bytes representation of a job-related event

func NewDependencyStillExists

func NewDependencyStillExists(entity1, entity2, keyID, id, desc string, a ...interface{}) error

NewDependencyStillExists creates a new error stating that a dependency between entity still exists and prevents deletion

func NewEntityAlreadyExists

func NewEntityAlreadyExists(entity, keyID, id, desc string, a ...interface{}) error

NewEntityAlreadyExists creates a new error stating that an entity already exists

func NewEntityNotFound

func NewEntityNotFound(entity, keyID, id, desc string, a ...interface{}) error

NewEntityNotFound creates a new error stating that an entity has not been found

func NewShouldNeverHappen

func NewShouldNeverHappen(desc string, a ...interface{}) error

NewShouldNeverHappen creates a new error that should never happen...

func NewUnhandledEvent

func NewUnhandledEvent(desc string, a ...interface{}) error

NewUnhandledEvent creates a new error stating that an event cannot be handled

func NewValidationError

func NewValidationError(desc string, a ...interface{}) error

NewValidationError creates a new validation error

func ResamplingStrings added in v0.5.1

func ResamplingStrings() []string

ResamplingStrings returns a slice of all String values of the enum

func StorageClassStrings added in v0.5.1

func StorageClassStrings() []string

StorageClassStrings returns a slice of all String values of the enum

func TaskStateStrings added in v0.5.1

func TaskStateStrings() []string

TaskStateStrings returns a slice of all String values of the enum

Types

type AOI

type AOI struct {
	ID       string
	Geometry *wkb.MultiPolygon
	// contains filtered or unexported fields
}

An AOI is by definition in *planar geometry* with *CRS 4326* (lonlat).

func NewAOIFromMultiPolygon added in v0.3.0

func NewAOIFromMultiPolygon(geomAOI geom.MultiPolygon) (*AOI, error)

NewAOIFromMultiPolygon creates an AOI from a multi polygon Only returns ValidationError

func NewAOIFromProtobuf

func NewAOIFromProtobuf(polygons []*pb.Polygon, canBeEmpty bool) (*AOI, error)

NewAOIFromProtobuf creates an AOI from protobuf Only returns ValidationError

func (*AOI) HashGeometry

func (aoi *AOI) HashGeometry() (string, error)

HashGeometry computes and returns a hash version of the geometry The hashing is computed only once, hence the geometry must not be changed.

func (*AOI) ToProtobuf

func (aoi *AOI) ToProtobuf() *pb.AOI

ToProtobuf converts an aoi to the protobuf. Could be optimized using flat_coordinates

type Bitmap

type Bitmap struct {
	// Bytes is the []byte representation of the image
	Bytes []byte
	// Bands is the number of interlaced bands
	Bands int
	// Rect is the image's bounds.
	Rect image.Rectangle
	// Datatype of the pixel
	DType DType
	// For conversion between dtype and byte
	ByteOrder binary.ByteOrder
}

Bitmap decribes any image as a bitmap of bytes

func NewBitmapFromDataset

func NewBitmapFromDataset(ds *godal.Dataset) (*Bitmap, error)

NewBitmapFromDataset creates a new bitmap from the dataset, copying the memory

func NewBitmapHeader

func NewBitmapHeader(r image.Rectangle, dtype DType, bands int) *Bitmap

NewBitmapHeader creates a new empty image (pixels are not allocated)

func (*Bitmap) SizeX

func (i *Bitmap) SizeX() int

SizeX returns the x size of the image

func (*Bitmap) SizeY

func (i *Bitmap) SizeY() int

SizeY returns the y size of the image

type Cell added in v0.3.0

type Cell struct {
	ID          string
	CRS         string
	SRID        int // Retrieved from CRS (not always possible)
	Coordinates proj.GeographicRing
}

type Compression

type Compression int32

Compression defines how the data is compressed in the file

const (
	CompressionNO Compression = iota
	CompressionLOSSLESS
	CompressionLOSSY
)

Supported compression

func CompressionString

func CompressionString(s string) (Compression, error)

CompressionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func CompressionValues

func CompressionValues() []Compression

CompressionValues returns all values of the enum

func (Compression) IsACompression

func (i Compression) IsACompression() bool

IsACompression returns "true" if the value is listed in the enum definition. "false" otherwise

func (Compression) MarshalJSON

func (i Compression) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Compression

func (*Compression) Scan

func (i *Compression) Scan(value interface{}) error

func (Compression) String

func (i Compression) String() string

func (*Compression) UnmarshalJSON

func (i *Compression) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Compression

func (Compression) Value

func (i Compression) Value() (driver.Value, error)

type ConsolidationContainer

type ConsolidationContainer struct {
	URI                string // "gs://bucket/mucog/random_name.TIF"
	DatasetFormat      DataMapping
	CRS                string       // "+init=epsg:XXXX" or WKT
	Transform          [6]float64   // [x0, 10, 0, y_0, 0, -10] Pixels of the image to coordinates in the CRS
	Width, Height      int          // 4096, 4096
	Cutline            string       // POLYGON(coords)
	BandsCount         int          // 3
	BlockXSize         int          // 256
	BlockYSize         int          // 256
	InterlacingPattern string       // L=0>T>I>P;I>L=1:>T>P (see github.com/airbusgeo/mucog)
	OverviewsMinSize   int          // Maximum width or height of the smallest overview level. 0=NO_OVERVIEW, -1=OVERVIEWS_DEFAULT_MIN_SIZE (=256)
	ResamplingAlg      Resampling   // "bilinear"
	OvrResamplingAlg   Resampling   // "regular"
	Compression        Compression  // "NO", "LOSSLESS", "LOSSY"
	StorageClass       StorageClass // "COLDLINE"
}

ConsolidationContainer contains all the information to create the output of the consolidation

func NewConsolidationContainer

func NewConsolidationContainer(URI string, variable *Variable, params *ConsolidationParams, layout *Layout, cell *grid.Cell) (*ConsolidationContainer, error)

NewConsolidationContainer initializes a new ConsolidationContainer

type ConsolidationDataset

type ConsolidationDataset struct {
	URI           string  // "gs://...."
	Subdir        string  // "GTIFF_DIR:1"
	Bands         []int64 // [1, 2, 3]
	Overviews     bool    // true (in case of reconsolidation, do not regenerate overviews if already exist)
	DatasetFormat DataMapping
}

ConsolidationDataset contains all the information on a dataset to consolidate it

func NewConsolidationDataset

func NewConsolidationDataset(d *Dataset) *ConsolidationDataset

NewConsolidationDataset initializes a new ConsolidationDataset

func (*ConsolidationDataset) InGroupOfContainers

func (d *ConsolidationDataset) InGroupOfContainers(c *ConsolidationContainer) bool

InGroupOfContainers returns true if the dataset is in the group of containers with the base name

func (*ConsolidationDataset) NeedsReconsolidation

func (d *ConsolidationDataset) NeedsReconsolidation(c *ConsolidationContainer) bool

NeedsReconsolidation returns true if the dataset must be reconsolidated Cannot check whether the compression, resampling_alg

type ConsolidationEvent

type ConsolidationEvent struct {
	JobID     string
	TaskID    string
	Records   []ConsolidationRecord
	Container ConsolidationContainer
}

ConsolidationEvent is an event sent to the consolidater to start a consolidation task

func UnmarshalConsolidationEvent

func UnmarshalConsolidationEvent(r io.Reader) (*ConsolidationEvent, error)

UnmarshalConsolidationEvent is used to retrieve a ConsolidationEvent from pubsub

type ConsolidationParams

type ConsolidationParams struct {
	DFormat       DataFormat
	Exponent      float64
	Compression   Compression
	ResamplingAlg Resampling
	StorageClass  StorageClass
	// contains filtered or unexported fields
}

ConsolidationParams defines the parameters for the consolidation

func NewConsolidationParamsFromProtobuf

func NewConsolidationParamsFromProtobuf(pbp *pb.ConsolidationParams) (*ConsolidationParams, error)

NewConsolidationParamsFromProtobuf creates a consolidation params from protobuf Only returns validationError

func (*ConsolidationParams) Clean

func (p *ConsolidationParams) Clean()

Clean sets the status Clean (everything has been persisted)

func (*ConsolidationParams) Deleted

func (p *ConsolidationParams) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (ConsolidationParams) IsActive

func (p ConsolidationParams) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (ConsolidationParams) IsClean

func (p ConsolidationParams) IsClean() bool

IsClean tests whether everything has been persisted

func (ConsolidationParams) IsDeleted

func (p ConsolidationParams) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (ConsolidationParams) IsDirty

func (p ConsolidationParams) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (ConsolidationParams) IsNew

func (p ConsolidationParams) IsNew() bool

IsNew tests whether the entity has never been persisted

func (ConsolidationParams) IsToDelete

func (p ConsolidationParams) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (*ConsolidationParams) ToProtobuf

func (c *ConsolidationParams) ToProtobuf() *pb.ConsolidationParams

ToProtobuf converts a consolidationParams to protobuf

type ConsolidationRecord

type ConsolidationRecord struct {
	ID         string
	DateTime   string //"2018-01-01 12:00:00"
	Datasets   []ConsolidationDataset
	ValidShape *proj.Shape
}

ConsolidationRecord contains the date and the list of datasets to consolidate

type Container

type Container struct {
	ID           int
	URI          string
	Managed      bool
	StorageClass StorageClass
	Datasets     []*Dataset
	// contains filtered or unexported fields
}

func NewContainerFromConsolidation

func NewContainerFromConsolidation(oc *ConsolidationContainer) (*Container, error)

NewContainerFromConsolidation creates a new container from the output of a consolidation task Only returns ValidationError

func NewContainerFromProtobuf

func NewContainerFromProtobuf(pbc *pb.Container) (*Container, error)

NewContainerFromProtobuf creates a new container from protobuf Only returns validationError

func (*Container) AddDataset

func (c *Container) AddDataset(d *Dataset) error

AddDataset to a container If the dataset already exists and is exactly the same, no errors are returned Only returns EntityAlreadyExists

func (*Container) Clean

func (c *Container) Clean(all bool)

Clean set the status Clean to the container and (if "all") all its datasets

func (*Container) Delete

func (c *Container) Delete() error

Delete set the status Delete to the container iif it is not managed and all the datasets are inactive

func (*Container) Deleted

func (p *Container) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (Container) IsActive

func (p Container) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Container) IsClean

func (p Container) IsClean() bool

IsClean tests whether everything has been persisted

func (Container) IsDeleted

func (p Container) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Container) IsDirty

func (p Container) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Container) IsNew

func (p Container) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Container) IsToDelete

func (p Container) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (*Container) RemoveDataset

func (c *Container) RemoveDataset(datasetID string) (bool, error)

RemoveDataset from a container Returns true if the container is empty Only returns EntityNotFound

func (*Container) SetStorageClass

func (c *Container) SetStorageClass(storageClass StorageClass) error

SetStorageClass of the container. It is only possible when the container is new.

type CustomGrid added in v0.3.0

type CustomGrid struct {
	Name string

	Flags      []string
	Parameters map[string]string
	// contains filtered or unexported fields
}

CustomGrid is a grid where each cell is defined either by Parameters["subgrid"] or by Parameters["resolution"]

func (*CustomGrid) Cell added in v0.3.0

func (cg *CustomGrid) Cell(uri string) (*gridlib.Cell, error)

Cell implements gridlib.Grid and returns a Cell with the provided URI (format : CellID/subGridID))

func (*CustomGrid) Covers added in v0.3.0

func (cg *CustomGrid) Covers(ctx context.Context, geomAOI *geom.MultiPolygon) (<-chan gridlib.StreamedURI, error)

Covers implements gridlib.Grid

type CustomGridInitializer added in v0.3.0

type CustomGridInitializer interface {
	ReadGrid(ctx context.Context, name string) (*Grid, error)
	FindCells(ctx context.Context, gridName string, aoi *AOI) ([]Cell, []geom.MultiPolygon, error)
}

type DType

type DType int

DType is one of supported DataTypes for raster

const (
	DTypeUNDEFINED DType = iota // reserved for bool
	DTypeUINT8
	DTypeUINT16
	DTypeUINT32
	DTypeINT8
	DTypeINT16
	DTypeINT32
	DTypeFLOAT32
	DTypeFLOAT64
	DTypeCOMPLEX64
)

Supported DataTypes

func DTypeFromGDal

func DTypeFromGDal(dtype godal.DataType) DType

DTypeFromGDal convert gdal.DataType to DType

func DTypeFromString

func DTypeFromString(dtype string) DType

DTypeFromString convert string dtype to DType

func DTypeString

func DTypeString(s string) (DType, error)

DTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func DTypeValues

func DTypeValues() []DType

DTypeValues returns all values of the enum

func (DType) IsADType

func (i DType) IsADType() bool

IsADType returns "true" if the value is listed in the enum definition. "false" otherwise

func (DType) IsFloatingPointFormat

func (dtype DType) IsFloatingPointFormat() bool

func (DType) MarshalJSON

func (i DType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for DType

func (*DType) Scan

func (i *DType) Scan(value interface{}) error

func (DType) Size

func (dtype DType) Size() int

Size returns the size of the dtype in bytes

func (DType) String

func (i DType) String() string

func (DType) ToGDAL

func (dtype DType) ToGDAL() godal.DataType

func (*DType) UnmarshalJSON

func (i *DType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for DType

func (DType) Value

func (i DType) Value() (driver.Value, error)

type DataFormat

type DataFormat struct {
	DType  DType
	NoData float64
	Range  Range
}

DataFormat describes the internal format of a raster

func NewDataFormatFromProtobuf

func NewDataFormatFromProtobuf(pbdf *pb.DataFormat) *DataFormat

func (DataFormat) Equals

func (df DataFormat) Equals(df2 DataFormat) bool

func (DataFormat) NoDataDefined

func (df DataFormat) NoDataDefined() bool

NoDataDefined returns True if the user has defined a NoData value. When NoData is not defined, its value is NaN, whatever the DataType

func (DataFormat) ToProtobuf added in v0.3.0

func (df DataFormat) ToProtobuf() *pb.DataFormat

type DataMapping

type DataMapping struct {
	DataFormat
	RangeExt Range   // External range maps to Internal range
	Exponent float64 // For non-linear mapping from RangeInt to RangeExt
}

DataMapping describes the mapping between an internal format and a external range vi in [Range.Min, Range.Max], ve in [RangeExt.Min, RangeExt.Max] are linked as follows: ve = RangeExt.Min + (RangeExt.Max - RangeExt.Min) * ((vi - Range.Min)/(Range.Max - Range.Min))^Exponent

func (DataMapping) Equals

func (dm DataMapping) Equals(dm2 DataMapping) bool

type Dataset

type Dataset struct {
	ID              string
	RecordID        string
	InstanceID      string
	ContainerURI    string
	ContainerSubDir string
	Bands           []int64
	DataMapping     DataMapping
	Status          DatasetStatus
	Shape           proj.Shape           ///< Valid shape in the crs of the dataset (may be smaller than the extent when there is nodata)
	GeogShape       proj.GeographicShape ///< Approximation of the valid shape in geographic coordinates
	GeomShape       proj.GeometricShape  ///< Approximation of the valid shape in 4326 coordinates
	Overviews       bool
	// contains filtered or unexported fields
}

func IncompleteDatasetFromConsolidation

func IncompleteDatasetFromConsolidation(c *ConsolidationContainer, instanceID string) (*Dataset, error)

IncompleteDatasetFromConsolidation returns a dataset partially initialized from the ConsolidationContainer of a consolidation task Only returns validationError

func NewDatasetFromIncomplete

func NewDatasetFromIncomplete(d Dataset, consolidationRecord ConsolidationRecord, subdir string) (*Dataset, error)

NewDatasetFromIncomplete creates a new dataset from dataset created by NewIncompleteDatasetFromConsolidation Only returns ValidationError

func NewDatasetFromProtobuf

func NewDatasetFromProtobuf(pbd *pb.Dataset, uri string) (*Dataset, error)

NewDatasetFromProtobuf creates a new dataset from protobuf Only returns validationError

func (*Dataset) Clean

func (p *Dataset) Clean()

Clean sets the status Clean (everything has been persisted)

func (*Dataset) Deleted

func (p *Dataset) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (*Dataset) GDALURI added in v0.4.0

func (d *Dataset) GDALURI() string

func (Dataset) IsActive

func (p Dataset) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Dataset) IsClean

func (p Dataset) IsClean() bool

IsClean tests whether everything has been persisted

func (Dataset) IsDeleted

func (p Dataset) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Dataset) IsDirty

func (p Dataset) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Dataset) IsNew

func (p Dataset) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Dataset) IsToDelete

func (p Dataset) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (*Dataset) SetDataType

func (d *Dataset) SetDataType(dtype DType) error

SetDataType sets the datatype flag of a new dataset

func (*Dataset) SetOverviews

func (d *Dataset) SetOverviews(hasOverviews bool) error

SetOverviews sets the overviews flag of a new dataset

func (*Dataset) SetShape

func (d *Dataset) SetShape(shape *geom.MultiPolygon, crsS string) error

SetShape sets the shape in a given CRS and bounding boxes of a new dataset

func (*Dataset) ValidateWithVariable

func (d *Dataset) ValidateWithVariable(v *Variable) error

ValidateWithVariable validates the instance using the full definition of the variable Only returns ValidationError

type DatasetStatus

type DatasetStatus int
const (
	DatasetStatusACTIVE DatasetStatus = iota
	DatasetStatusTODELETE
	DatasetStatusINACTIVE
)

func DatasetStatusString

func DatasetStatusString(s string) (DatasetStatus, error)

DatasetStatusString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func DatasetStatusValues

func DatasetStatusValues() []DatasetStatus

DatasetStatusValues returns all values of the enum

func (DatasetStatus) IsADatasetStatus

func (i DatasetStatus) IsADatasetStatus() bool

IsADatasetStatus returns "true" if the value is listed in the enum definition. "false" otherwise

func (DatasetStatus) MarshalJSON

func (i DatasetStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for DatasetStatus

func (*DatasetStatus) Scan

func (i *DatasetStatus) Scan(value interface{}) error

func (DatasetStatus) String

func (i DatasetStatus) String() string

func (*DatasetStatus) UnmarshalJSON

func (i *DatasetStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for DatasetStatus

func (DatasetStatus) Value

func (i DatasetStatus) Value() (driver.Value, error)

type ErrorCode

type ErrorCode int
const (
	EntityValidationError ErrorCode = iota
	EntityNotFound
	EntityAlreadyExists
	DependencyStillExists
	UnhandledEvent
	ShouldNeverHappen
)

type Event

type Event interface{}

Event is a common interface for all job-related events

func UnmarshalEvent

func UnmarshalEvent(r io.Reader) (Event, error)

UnmarshalEvent returns the event stored in the Reader

type ExecutionLevel added in v0.3.0

type ExecutionLevel int32
const (
	ExecutionSynchronous  ExecutionLevel = iota // Job is done synchronously
	ExecutionAsynchronous                       // Job is done asynchronously, but without any pause
	StepByStepCritical                          // Job is done asynchronously, step-by-step, pausing at every critical steps
	StepByStepMajor                             // Job is done asynchronously, step-by-step, pausing at every major steps
	StepByStepAll                               // Job is done asynchronously, step-by-step, pausing at every steps

	StepByStepNever // For a JobState to never be paused
)

ExecutionLevel

type GeocubeError

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

func AsError

func AsError(err error, code ErrorCode) (GeocubeError, bool)

AsError tests whether error is a GeocubeError and returns it

func (GeocubeError) Code

func (e GeocubeError) Code() ErrorCode

Code returns the code of the error

func (GeocubeError) Desc

func (e GeocubeError) Desc() string

Desc returns a description of the error

func (GeocubeError) Detail

func (e GeocubeError) Detail(i int) string

Detail returns a detail of the error (see const above)

func (GeocubeError) Error

func (e GeocubeError) Error() string

Error implements error

type Grid added in v0.3.0

type Grid struct {
	Name        string
	Description string
	Cells       []Cell
}

func NewGridFromProtobuf added in v0.3.0

func NewGridFromProtobuf(grid *pb.Grid) (*Grid, error)

NewGridFromProtobuf creates a grid from protobuf and validates it Only returns validationError

func (*Grid) ToProtobuf added in v0.3.0

func (g *Grid) ToProtobuf() *pb.Grid

ToProtobuf converts a consolidationParams to protobuf

type Job

type Job struct {
	State        JobState
	ID           string
	Name         string
	Type         JobType
	CreationTime time.Time

	LastUpdateTime time.Time
	Payload        JobPayload
	Logs           JobLogs
	LogsCount      int
	NewLogs        JobLogs // logs that are not yet persisted in bdd
	ActiveTasks    int
	FailedTasks    int
	ExecutionLevel ExecutionLevel
	Waiting        bool

	// These following fields may not be loaded
	Tasks  []*Task
	Params JobParams

	LockedDatasets [int32(LockFlagNB)]LockedDatasets
	// contains filtered or unexported fields
}

func NewConsolidationJob

func NewConsolidationJob(jobName, layout, instanceID string, executionLevel ExecutionLevel) (*Job, error)

NewConsolidationJob creates a new consolidation Job

func NewDeletionJob added in v0.3.0

func NewDeletionJob(jobName string, executionLevel ExecutionLevel) *Job

NewDeletionJob creates a new Job to delete datasets and containers

func NewJob

func NewJob(id string) *Job

NewJob creates a new empty Job with a logger

func (*Job) CancelTask

func (j *Job) CancelTask(index int)

CancelTask sets the cancel state to the task with the given index

func (*Job) Clean

func (j *Job) Clean(all bool)

Clean overrides persistentState.Clean and set the status Clean to the job "all" also sets the status to the locked datasets and all its tasks

func (*Job) ClearPersistedLogs added in v0.6.0

func (j *Job) ClearPersistedLogs()

func (*Job) CreateConsolidationTask

func (j *Job) CreateConsolidationTask(evt ConsolidationEvent) error

CreateConsolidationTask adds a new consolidation task with the event provided

func (*Job) CreateDeletionTask added in v0.3.0

func (j *Job) CreateDeletionTask(containerURI string) error

CreateDeletionTask adds a new deletion task with the container uri provided

func (*Job) DeleteAllTasks

func (j *Job) DeleteAllTasks()

DeleteAllTasks set the status ToDelete to all the tasks

func (*Job) DeleteTask

func (j *Job) DeleteTask(index int)

DeleteTask set the status ToDelete to one task

func (*Job) Deleted

func (p *Job) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (Job) IsActive

func (p Job) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Job) IsClean

func (p Job) IsClean() bool

IsClean tests whether everything has been persisted

func (Job) IsDeleted

func (p Job) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Job) IsDirty

func (p Job) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Job) IsNew

func (p Job) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Job) IsToDelete

func (p Job) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (*Job) LockDatasets

func (j *Job) LockDatasets(datasetsID []string, flag LockFlag)

LockDatasets set the status New to the lock of the datasets (flag = LockFlagINIT/LockFlagTODELETE/LockFlagNEW) and adds the datasets

func (*Job) LogErr added in v0.3.0

func (j *Job) LogErr(err string)

LogErr updates and append the error status

func (*Job) LogMsg added in v0.3.0

func (j *Job) LogMsg(severity LogSeverity, msg string)

LogMsg updates and append the log status of Job

func (*Job) LogMsgf added in v0.3.0

func (j *Job) LogMsgf(severity LogSeverity, msg string, args ...interface{})

LogMsgf updates and append the log status of Job

func (*Job) OCCTime

func (j *Job) OCCTime() time.Time

OCCTime returns a timestamp used to do Optimistic Concurrency Control

func (*Job) ReleaseDatasets

func (j *Job) ReleaseDatasets(flag LockFlag)

ReleaseDatasets set the status ToDelete to the lock of the datasets (any flags)

func (*Job) ResetTasks added in v0.6.0

func (j *Job) ResetTasks(states []TaskState)

ResetTasks sets the pending state to all the tasks and the job status

func (*Job) SetParams added in v0.3.0

func (j *Job) SetParams(params ConsolidationParams) error

func (*Job) ToDelete

func (j *Job) ToDelete(all bool) bool

ToDelete sets the status ToDelete to the job iif tasks are also ToDelete or empty If all, also delete tasks Return success

func (*Job) ToProtobuf

func (j *Job) ToProtobuf(offset int) (*pb.Job, error)

ToProtobuf converts a job to protobuf

func (*Job) Trigger

func (j *Job) Trigger(evt JobEvent) error

Trigger handles the event and change the state of the job Only returns UnhandledEvent

func (*Job) UpdateTask

func (j *Job) UpdateTask(evt TaskEvent) error

UpdateTask updates the status of the task depending on the event The task must exists and in pending state

type JobEvent

type JobEvent struct {
	JobID  string
	Status JobStatus
	Error  string
}

JobEvent is the event sent during the job when one of the job steps is finished JobEvent implements Event

func NewJobEvent

func NewJobEvent(jobID string, status JobStatus, err string) *JobEvent

NewJobEvent returns a JobEvent and check that all the fields have been filled panic if an error is set and it's a non-error status and inversely

type JobLog added in v0.3.0

type JobLog struct {
	Severity LogSeverity `json:"severity,omitempty"`
	Msg      string      `json:"message,omitempty"`
	Status   string      `json:"status,omitempty"`
	Date     time.Time   `json:"time,omitempty"`
}

type JobLogs added in v0.3.0

type JobLogs []JobLog

func (JobLogs) Len added in v0.3.0

func (jl JobLogs) Len() int

func (JobLogs) Less added in v0.3.0

func (jl JobLogs) Less(i, j int) bool

func (*JobLogs) Scan added in v0.3.0

func (jl *JobLogs) Scan(value interface{}) error

Scan implements the sql.Scanner interface for a JobLogs. This method simply decodes a JSON-encoded value into the struct fields.

func (JobLogs) Swap added in v0.3.0

func (jl JobLogs) Swap(i, j int)

func (JobLogs) Value added in v0.3.0

func (jl JobLogs) Value() (driver.Value, error)

Value implements the driver.Valuer interface for a JobLogs. This method simply returns the JSON-encoded representation of the struct.

type JobParams

type JobParams interface {
	IsNew() bool
	IsToDelete() bool
	IsDirty() bool
	Deleted()
	Clean()
}

type JobPayload

type JobPayload struct {
	Layout     string `json:"layout,omitempty"`
	InstanceID string `json:"instance_id,omitempty"`
	ParamsID   string `json:"params_id,omitempty"`
}

JobPayload contains all the information to process a job

func (*JobPayload) Scan

func (jp *JobPayload) Scan(value interface{}) error

Scan implements the sql.Scanner interface for a jobPayload. This method simply decodes a JSON-encoded value into the struct fields.

func (JobPayload) Value

func (jp JobPayload) Value() (driver.Value, error)

Value implements the driver.Valuer interface for a jobPayload. This method simply returns the JSON-encoded representation of the struct.

type JobState

type JobState int32
const (
	JobStateNEW JobState = iota
	JobStateCREATED

	JobStateCONSOLIDATIONINPROGRESS
	JobStateCONSOLIDATIONDONE
	JobStateCONSOLIDATIONINDEXED
	JobStateCONSOLIDATIONEFFECTIVE
	JobStateCONSOLIDATIONFAILED
	JobStateCONSOLIDATIONRETRYING
	JobStateCONSOLIDATIONFORCERETRYING
	JobStateCONSOLIDATIONCANCELLING

	JobStateDELETIONINPROGRESS
	JobStateDELETIONEFFECTIVE
	JobStateDELETIONFAILED

	JobStateDONE

	JobStateFAILED
	JobStateINITIALISATIONFAILED
	JobStateCANCELLATIONFAILED
	JobStateABORTED
	JobStateROLLBACKFAILED
	JobStateDONEBUTUNTIDY
)

func JobStateString

func JobStateString(s string) (JobState, error)

JobStateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func JobStateValues

func JobStateValues() []JobState

JobStateValues returns all values of the enum

func (JobState) IsAJobState

func (i JobState) IsAJobState() bool

IsAJobState returns "true" if the value is listed in the enum definition. "false" otherwise

func (JobState) MarshalJSON

func (i JobState) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for JobState

func (*JobState) Scan

func (i *JobState) Scan(value interface{}) error

func (JobState) String

func (i JobState) String() string

func (*JobState) UnmarshalJSON

func (i *JobState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for JobState

func (JobState) Value

func (i JobState) Value() (driver.Value, error)

type JobStateInfo added in v0.3.0

type JobStateInfo struct {
	Level       ExecutionLevel
	RetryForced bool // if event = RetryForced, retry the current state (other behaviors can be defined in the trigger...() functions )
}

type JobStatus

type JobStatus int32

JobStatus defines an event emitted when a step of a job is finished

const (
	JobCreated JobStatus = iota
	OrdersPrepared
	PrepareOrdersFailed
	SendOrdersFailed
	ConsolidationDone
	ConsolidationFailed
	ConsolidationRetryFailed
	ConsolidationIndexed
	ConsolidationIndexingFailed

	DatasetsSwapped
	SwapDatasetsFailed
	DeletionStarted
	StartDeletionFailed

	DeletionReady
	DeletionNotReady
	RemovalDone
	DeletionDone
	RemovalFailed
	DeletionFailed

	CancelledByUser
	CancelledByUserForced
	CancellationFailed
	CancellationDone

	RollbackFailed
	RollbackDone

	Retried
	RetryForced

	Continue
)

Possible status of a finished step

func JobStatusString added in v0.3.0

func JobStatusString(s string) (JobStatus, error)

JobStatusString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func JobStatusValues added in v0.3.0

func JobStatusValues() []JobStatus

JobStatusValues returns all values of the enum

func (JobStatus) IsAJobStatus added in v0.3.0

func (i JobStatus) IsAJobStatus() bool

IsAJobStatus returns "true" if the value is listed in the enum definition. "false" otherwise

func (JobStatus) MarshalJSON added in v0.3.0

func (i JobStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for JobStatus

func (*JobStatus) Scan added in v0.3.0

func (i *JobStatus) Scan(value interface{}) error

func (JobStatus) String

func (i JobStatus) String() string

func (*JobStatus) UnmarshalJSON added in v0.3.0

func (i *JobStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for JobStatus

func (JobStatus) Value added in v0.3.0

func (i JobStatus) Value() (driver.Value, error)

type JobType

type JobType int32
const (
	JobTypeCONSOLIDATION JobType = iota
	JobTypeINGESTION
	JobTypeDELETION
)

func JobTypeString

func JobTypeString(s string) (JobType, error)

JobTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func JobTypeValues

func JobTypeValues() []JobType

JobTypeValues returns all values of the enum

func (JobType) IsAJobType

func (i JobType) IsAJobType() bool

IsAJobType returns "true" if the value is listed in the enum definition. "false" otherwise

func (JobType) MarshalJSON

func (i JobType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for JobType

func (*JobType) Scan

func (i *JobType) Scan(value interface{}) error

func (JobType) String

func (i JobType) String() string

func (*JobType) UnmarshalJSON

func (i *JobType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for JobType

func (JobType) Value

func (i JobType) Value() (driver.Value, error)

type Layout

type Layout struct {
	Name string

	// External layout: Grid:Cell (CRS)
	GridFlags      []string
	GridParameters Metadata

	// Internal layout: Cell, tile
	BlockXSize, BlockYSize int
	MaxRecords             int
	OverviewsMinSize       int
	InterlacingPattern     string
	// contains filtered or unexported fields
}

func NewLayoutFromProtobuf

func NewLayoutFromProtobuf(pbl *pb.Layout, ignoreName bool) (*Layout, error)

NewLayoutFromProtobuf creates a layout from protobuf and validates it Only returns validationError if ignoreName=True, do not validate Name

func (*Layout) Covers

func (l *Layout) Covers(ctx context.Context, aoi *geom.MultiPolygon, removeDuplicate bool) (<-chan StreamedCell, error)

Covers returns all the cells of the layout covered by the AOI

func (*Layout) InitGrid added in v0.3.0

func (l *Layout) InitGrid(ctx context.Context, initializer CustomGridInitializer) error

InitGrid if necessary

func (*Layout) MucogInterlacingPattern added in v0.6.0

func (l *Layout) MucogInterlacingPattern() string

MucogInterlacingPattern replaces [R]ecord by [I]mage, [B]and by [P]lane and [Z]oom by [L]evel (see github.com/airbusgeo/mucog)

func (*Layout) ToProtobuf

func (l *Layout) ToProtobuf() *pb.Layout

ToProtobuf converts a layout to protobuf

type LockFlag

type LockFlag int32
const (
	LockFlagALL LockFlag = iota - 1
	LockFlagINIT
	LockFlagTODELETE
	LockFlagNEW
	LockFlagNB
)

LockFlag to state why the dataset is locked

type LockedDatasets

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

func (*LockedDatasets) Clean

func (l *LockedDatasets) Clean()

Clean overrides persistenceState.Clean()

func (*LockedDatasets) Deleted

func (p *LockedDatasets) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (LockedDatasets) IsActive

func (p LockedDatasets) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (LockedDatasets) IsClean

func (p LockedDatasets) IsClean() bool

IsClean tests whether everything has been persisted

func (LockedDatasets) IsDeleted

func (p LockedDatasets) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (LockedDatasets) IsDirty

func (p LockedDatasets) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (LockedDatasets) IsNew

func (p LockedDatasets) IsNew() bool

IsNew tests whether the entity has never been persisted

func (LockedDatasets) IsToDelete

func (p LockedDatasets) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (LockedDatasets) NewIDs

func (l LockedDatasets) NewIDs() []string

NewIDs returns the ID of the datasets to be locked Only the new ids are available (those who are already locked are not available)

type LogSeverity added in v0.3.0

type LogSeverity string
const (
	DEBUG LogSeverity = "DEBUG"
	INFO  LogSeverity = "INFO"
	WARN  LogSeverity = "WARN"
	ERROR LogSeverity = "ERROR"
)

type Metadata

type Metadata map[string]string

Metadata adds information to the entity

func (*Metadata) Scan

func (m *Metadata) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (Metadata) Value

func (m Metadata) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Palette

type Palette struct {
	Name   string
	Points []colorPoint
	// contains filtered or unexported fields
}

Palette is a mapping between [0, 1] to RGBA color

func NewPaletteFromPb

func NewPaletteFromPb(pbp *pb.Palette) (Palette, error)

NewPaletteFromPb creates a new palette from pb Returns ValidationError

func (*Palette) Clean

func (p *Palette) Clean()

Clean sets the status Clean (everything has been persisted)

func (*Palette) Deleted

func (p *Palette) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (Palette) IsActive

func (p Palette) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Palette) IsClean

func (p Palette) IsClean() bool

IsClean tests whether everything has been persisted

func (Palette) IsDeleted

func (p Palette) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Palette) IsDirty

func (p Palette) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Palette) IsNew

func (p Palette) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Palette) IsToDelete

func (p Palette) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (Palette) PaletteN

func (p Palette) PaletteN(n int) color.Palette

Palette256 returns the color.Palette mapping [0, N] to colors

func (Palette) Validate

func (p Palette) Validate() error

Validate valids the Palette

type Range

type Range struct {
	Min, Max float64
}

Range of values

func (Range) Interval

func (r Range) Interval() float64

type Record

type Record struct {
	ID   string
	Name URN
	Time time.Time
	Tags Metadata
	AOI  AOI
	// contains filtered or unexported fields
}

func NewRecordFromProtobuf

func NewRecordFromProtobuf(record *pb.NewRecord) (*Record, error)

NewRecordFromProtobuf creates a new record from protobuf and validates it Only returns ValidationError

func RecordFromProtobuf added in v0.4.0

func RecordFromProtobuf(record *pb.Record) (*Record, error)

RecordFromProtobuf creates a new record from protobuf and validates it Only returns ValidationError

func (*Record) Clean

func (p *Record) Clean()

Clean sets the status Clean (everything has been persisted)

func (*Record) Deleted

func (p *Record) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (Record) IsActive

func (p Record) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Record) IsClean

func (p Record) IsClean() bool

IsClean tests whether everything has been persisted

func (Record) IsDeleted

func (p Record) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Record) IsDirty

func (p Record) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Record) IsNew

func (p Record) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Record) IsToDelete

func (p Record) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (*Record) ToProtobuf

func (r *Record) ToProtobuf(withAOI bool) *pb.Record

ToProtobuf convers a record to a protobuf

type Resampling

type Resampling int32

Resampling defines how the raster is resampled when its size has to be changed

const (
	ResamplingNEAR Resampling
	ResamplingBILINEAR
	ResamplingCUBIC
	ResamplingCUBICSPLINE
	ResamplingLANCZOS
	ResamplingAVERAGE
	ResamplingMODE
	ResamplingMAX
	ResamplingMIN
	ResamplingMED
	ResamplingQ1
	ResamplingQ3
)

Supported values for resampling (gdal resampling methods)

func ResamplingString

func ResamplingString(s string) (Resampling, error)

ResamplingString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ResamplingValues

func ResamplingValues() []Resampling

ResamplingValues returns all values of the enum

func (Resampling) IsAResampling

func (i Resampling) IsAResampling() bool

IsAResampling returns "true" if the value is listed in the enum definition. "false" otherwise

func (Resampling) MarshalJSON

func (i Resampling) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Resampling

func (*Resampling) Scan

func (i *Resampling) Scan(value interface{}) error

func (Resampling) String

func (i Resampling) String() string

func (Resampling) ToGDAL

func (r Resampling) ToGDAL() godal.ResamplingAlg

func (*Resampling) UnmarshalJSON

func (i *Resampling) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Resampling

func (Resampling) Value

func (i Resampling) Value() (driver.Value, error)

type StorageClass

type StorageClass int
const (
	StorageClassSTANDARD StorageClass = iota
	StorageClassINFREQUENT
	StorageClassARCHIVE
	StorageClassDEEPARCHIVE
	StorageClassUNDEFINED
)

func StorageClassString

func StorageClassString(s string) (StorageClass, error)

StorageClassString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StorageClassValues

func StorageClassValues() []StorageClass

StorageClassValues returns all values of the enum

func ToGcStorageClass

func ToGcStorageClass(s string) (StorageClass, error)

ToGcStorageClass returns the geocube storage class equivalent

func ToStorageClass

func ToStorageClass(s string) (StorageClass, error)

ToStorageClass returns the geocube sorage class equivalent

func (StorageClass) IsAStorageClass

func (i StorageClass) IsAStorageClass() bool

IsAStorageClass returns "true" if the value is listed in the enum definition. "false" otherwise

func (StorageClass) MarshalJSON

func (i StorageClass) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for StorageClass

func (*StorageClass) Scan

func (i *StorageClass) Scan(value interface{}) error

func (StorageClass) String

func (i StorageClass) String() string

func (*StorageClass) UnmarshalJSON

func (i *StorageClass) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for StorageClass

func (StorageClass) Value

func (i StorageClass) Value() (driver.Value, error)

type StreamedCell added in v0.3.0

type StreamedCell struct {
	*gridlib.Cell
	Error error
}

type Task

type Task struct {
	ID      string
	State   TaskState
	Payload []byte
	// contains filtered or unexported fields
}

func (*Task) Clean

func (p *Task) Clean()

Clean sets the status Clean (everything has been persisted)

func (*Task) ConsolidationOutput

func (t *Task) ConsolidationOutput() (*ConsolidationContainer, []ConsolidationRecord, error)

ConsolidationOutput retrieves the output of the consolidation payload

func (*Task) Deleted

func (p *Task) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (*Task) DeletionPayload added in v0.3.0

func (t *Task) DeletionPayload() (string, error)

DeletionPayload retrieves the deletion payload

func (Task) IsActive

func (p Task) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Task) IsClean

func (p Task) IsClean() bool

IsClean tests whether everything has been persisted

func (Task) IsDeleted

func (p Task) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Task) IsDirty

func (p Task) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Task) IsNew

func (p Task) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Task) IsToDelete

func (p Task) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

type TaskEvent

type TaskEvent struct {
	JobID  string
	TaskID string
	Status TaskStatus
	Error  string
}

TaskEvent is the event sent from the consolidater when a consolidation task is finished TaskEvent implements Event

func NewTaskEvent

func NewTaskEvent(jobID, taskID string, eventStatus TaskStatus, err error) *TaskEvent

NewTaskEvent returns a new task event

type TaskState

type TaskState int32
const (
	// TaskStateFAILED when the execution encountered an error
	TaskStateFAILED TaskState = iota
	// TaskStateCANCELLED when the task is cancelled by the server or there is no operation to perform (consolidation task: no container is created)
	TaskStateCANCELLED
	// TaskStateDONE when the task is finished and successful
	TaskStateDONE
	// TaskStatePENDING when the task is in progress
	TaskStatePENDING
	// TaskStateNEW when the task is created and waiting for being sent
	TaskStateNEW
)

func TaskStateString

func TaskStateString(s string) (TaskState, error)

TaskStateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func TaskStateValues

func TaskStateValues() []TaskState

TaskStateValues returns all values of the enum

func (TaskState) IsATaskState

func (i TaskState) IsATaskState() bool

IsATaskState returns "true" if the value is listed in the enum definition. "false" otherwise

func (TaskState) MarshalJSON

func (i TaskState) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for TaskState

func (*TaskState) Scan

func (i *TaskState) Scan(value interface{}) error

func (TaskState) String

func (i TaskState) String() string

func (*TaskState) UnmarshalJSON

func (i *TaskState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for TaskState

func (TaskState) Value

func (i TaskState) Value() (driver.Value, error)

type TaskStatus

type TaskStatus int32

TaskStatus is the status of a finished task

const (
	TaskSuccessful TaskStatus = iota
	TaskFailed
	// TaskIgnored if there is nothing to perform
	TaskIgnored
	// TaskCancelled if the task has been cancelled externally (nothing has been done)
	TaskCancelled
	// TaskSent
	TaskSent
)

Possible status of a finished task

func (TaskStatus) String

func (ts TaskStatus) String() string

type URN

type URN string

URN (Unique Ressource Name) for Record, VariableDefinition, Palette... format: Seg1/Seg2/... (allowing special caracters: "-:_")

func (*URN) Scan

func (urn *URN) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (URN) Value

func (urn URN) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Variable

type Variable struct {
	ID        string
	Name      string
	Instances map[string]*VariableInstance
	Unit      string

	// Description [mutable]
	Description string

	// Storage [immutable]
	Bands   []string
	DFormat DataFormat

	// Views [mutable]
	Palette string

	// Default resampling algorithm [mutable]
	Resampling Resampling

	// Consolidation parameters
	ConsolidationParams ConsolidationParams
	// contains filtered or unexported fields
}

Variable described data

func NewVariableFromProtobuf

func NewVariableFromProtobuf(pbv *pb.Variable) (*Variable, error)

NewVariableFromProtobuf creates a variable from protobuf and validates it Only returns validationError

func (*Variable) AddInstance

func (v *Variable) AddInstance(vi *VariableInstance) error

AddInstance adds a new instance if possible

func (*Variable) CheckInstanceExists

func (v *Variable) CheckInstanceExists(instanceID string) error

CheckInstanceExists checks that the instance belongs to the variable

func (*Variable) Clean

func (v *Variable) Clean(all bool)

Clean sets the status Clean to the variable and (if "all") all its instances

func (*Variable) Deleted

func (p *Variable) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (Variable) IsActive

func (p Variable) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (Variable) IsClean

func (p Variable) IsClean() bool

IsClean tests whether everything has been persisted

func (Variable) IsDeleted

func (p Variable) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (Variable) IsDirty

func (p Variable) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (Variable) IsNew

func (p Variable) IsNew() bool

IsNew tests whether the entity has never been persisted

func (Variable) IsToDelete

func (p Variable) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

func (*Variable) SetConsolidationParams

func (v *Variable) SetConsolidationParams(params ConsolidationParams) error

SetConsolidationParams sets the consolidation parameters Only returns ValidationError

func (*Variable) ToDelete

func (v *Variable) ToDelete(instanceID string)

ToDelete sets the status ToDelete to one instance or to all instances and the variable itselfs

func (*Variable) ToProtobuf

func (v *Variable) ToProtobuf() *pb.Variable

ToProtobuf converts a variable to a protobuf

func (*Variable) Update

func (v *Variable) Update(name, unit, description, palette *string, resampling *Resampling) error

Update updates the variable

func (*Variable) UpdateInstance

func (v *Variable) UpdateInstance(instanceID string, name *string, newMetadata map[string]string, delMetadataKeys []string) error

UpdateInstance updates an instance of the variable

type VariableInstance

type VariableInstance struct {
	ID       string
	Name     string
	Metadata Metadata
	// contains filtered or unexported fields
}

VariableInstance is an instance of the VariableDefinition

func NewInstance

func NewInstance(name string, metadata map[string]string) (*VariableInstance, error)

NewInstance creates a variable instance and validates it

func (*VariableInstance) Clean

func (p *VariableInstance) Clean()

Clean sets the status Clean (everything has been persisted)

func (*VariableInstance) Deleted

func (p *VariableInstance) Deleted()

Deleted sets the status Deleted (the entity is not longer reachable)

func (VariableInstance) IsActive

func (p VariableInstance) IsActive() bool

IsActive returns true if the entity is New, Clean or Dirty

func (VariableInstance) IsClean

func (p VariableInstance) IsClean() bool

IsClean tests whether everything has been persisted

func (VariableInstance) IsDeleted

func (p VariableInstance) IsDeleted() bool

IsDeleted returns true if the entity is deleted

func (VariableInstance) IsDirty

func (p VariableInstance) IsDirty() bool

IsDirty tests whether the entity has to be persisted

func (VariableInstance) IsNew

func (p VariableInstance) IsNew() bool

IsNew tests whether the entity has never been persisted

func (VariableInstance) IsToDelete

func (p VariableInstance) IsToDelete() bool

IsToDelete tests whether the entity has to be deleted

Jump to

Keyboard shortcuts

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