grpc

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: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeocubeServerVersion = "1.0.2"
	StreamTilesBatchSize = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloaderService added in v0.4.0

type DownloaderService struct {
	pb.UnimplementedGeocubeDownloaderServer
	// contains filtered or unexported fields
}

DownloaderService is the GRPC service

func NewDownloader added in v0.4.0

func NewDownloader(gdsvc GeocubeDownloaderService, maxConnectionAgeSec int) *DownloaderService

NewDownloader returns a new GRPC DownloaderService connected to an DownloaderService

func (*DownloaderService) DownloadCube added in v0.4.0

GetCube implements DownloaderService

func (*DownloaderService) Version added in v0.4.0

Version returns version of the geocube

type GeocubeDownloaderService added in v0.4.0

type GeocubeDownloaderService interface {
	// GetCubeFromMetadatas requests a cube of data from metadatas generated with a previous call to GetCube()
	GetCubeFromMetadatas(ctx context.Context, metadatas []internal.SliceMeta, grecords [][]*geocube.Record,
		refDf geocube.DataFormat, crs *godal.SpatialRef, pixToCRS *affine.Affine, width, height int, options internal.GetCubeOptions) (internal.CubeInfo, <-chan internal.CubeSlice, error)
}

GeocubeDownloaderService contains the downloader service

type GeocubeService

type GeocubeService interface {
	CreateAOI(ctx context.Context, aoi *geocube.AOI) error
	GetAOI(ctx context.Context, aoiID string) (*geocube.AOI, error)
	CreateRecords(ctx context.Context, records []*geocube.Record) error
	GetRecords(ctx context.Context, ids []string) ([]*geocube.Record, error)
	DeleteRecords(ctx context.Context, ids []string) (int64, error)
	ListRecords(ctx context.Context, namelike string, tags geocube.Metadata, fromTime, toTime time.Time, aoi *geocube.AOI, page, limit int, withAOI bool) ([]*geocube.Record, error)
	AddRecordsTags(ctx context.Context, ids []string, tags geocube.Metadata) (int64, error)
	RemoveRecordsTags(ctx context.Context, ids []string, tagsKey []string) (int64, error)

	CreateVariable(ctx context.Context, variable *geocube.Variable) error
	UpdateVariable(ctx context.Context, variableID string, name, unit, description, palette *string, resampling *geocube.Resampling) error
	// Retrieves variable with the first not-empty parameter
	GetVariable(ctx context.Context, variableID, instanceID, variableName string) (*geocube.Variable, error)
	InstantiateVariable(ctx context.Context, variableID string, instance *geocube.VariableInstance) error
	ListVariables(ctx context.Context, namelike string, page, limit int) ([]*geocube.Variable, error)
	UpdateInstance(ctx context.Context, id string, name *string, newMetadata map[string]string, delMetadataKeys []string) error
	// DeleteVariable delete the variable and all its instances iif not used anymore
	DeleteVariable(ctx context.Context, id string) error
	// DeleteInstance delete the instance iif not used anymore
	DeleteInstance(ctx context.Context, id string) error
	CreatePalette(ctx context.Context, palette *geocube.Palette, replaceIfExists bool) error

	// Index datasets that are not fully known. Checks that the container is reachable and get some missing informations.
	IndexExternalDatasets(ctx context.Context, container *geocube.Container, datasets []*geocube.Dataset) error
	ConfigConsolidation(ctx context.Context, variableID string, params geocube.ConsolidationParams) error
	GetConsolidationParams(ctx context.Context, ID string) (*geocube.ConsolidationParams, error)
	ConsolidateFromRecords(ctx context.Context, job *geocube.Job, recordsID []string) error
	ConsolidateFromFilters(ctx context.Context, job *geocube.Job, tags map[string]string, fromTime, toTime time.Time) error
	ListJobs(ctx context.Context, nameLike string) ([]*geocube.Job, error)
	GetJob(ctx context.Context, jobID string, opts ...database.ReadJobOptions) (*geocube.Job, error)
	RetryJob(ctx context.Context, jobID string, forceAnyState bool) error
	CancelJob(ctx context.Context, jobID string, forceAnyState bool) error
	ContinueJob(ctx context.Context, jobID string) error
	CleanJobs(ctx context.Context, nameLike string, state *geocube.JobState) (int, error)

	CreateGrid(ctx context.Context, grid *geocube.Grid) error
	DeleteGrid(ctx context.Context, name string) error
	ListGrids(ctx context.Context, nameLike string) ([]*geocube.Grid, error)

	CreateLayout(ctx context.Context, layout *geocube.Layout) error
	DeleteLayout(ctx context.Context, name string) error
	ListLayouts(ctx context.Context, nameLike string) ([]*geocube.Layout, error)
	FindContainerLayouts(ctx context.Context, instanceId string, aoi *geocube.AOI, recordIds []string, tags map[string]string, fromTime, toTime time.Time) ([]string, [][]string, error)
	TileAOI(ctx context.Context, aoi *geocube.AOI, layoutName string, layout *geocube.Layout) (<-chan geocube.StreamedCell, error)

	GetXYZTile(ctx context.Context, recordsID []string, instanceID string, a, b, z int) ([]byte, error)
	GetCubeFromRecords(ctx context.Context, recordsID [][]string, instancesID []string, crs *godal.SpatialRef, pixToCRS *affine.Affine, width, height int, options internal.GetCubeOptions) (internal.CubeInfo, <-chan internal.CubeSlice, error)
	GetCubeFromFilters(ctx context.Context, recordTags geocube.Metadata, fromTime, toTime time.Time, instancesID []string, crs *godal.SpatialRef, pixToCRS *affine.Affine, width, height int, options internal.GetCubeOptions) (internal.CubeInfo, <-chan internal.CubeSlice, error)
}

GeocubeService contains all the business services

type GeocubeServiceAdmin

type GeocubeServiceAdmin interface {
	// TidyPending remove from the database the entities that are not linked to any dataset
	TidyPending(ctx context.Context, aois, records, variables, instances, containers, params bool, simulate bool) ([]int64, error)
	// UpdateDatasets given the instance id
	UpdateDatasets(ctx context.Context, simulate bool, instanceID string, RecordIds []string, dmapping geocube.DataMapping) (map[string]int64, error)
	// DeleteDatasets given the instance id
	DeleteDatasets(ctx context.Context, jobName string, instanceIDs, recordIDs, datasetPatterns []string, executionLevel geocube.ExecutionLevel) (*geocube.Job, error)
}

GeocubeServiceAdmin contains all the admin services

type Service

type Service struct {
	pb.UnimplementedGeocubeServer
	// contains filtered or unexported fields
}

Service is the GRPC service

func New

func New(gsvc GeocubeService, maxConnectionAgeSec int) *Service

New returns a new GRPC Service connected to a business Service

func (*Service) AddRecordsTags

func (svc *Service) AddRecordsTags(ctx context.Context, req *pb.AddRecordsTagsRequest) (*pb.AddRecordsTagsResponse, error)

AddRecordsTags adds tags on list of records

func (*Service) CancelJob

func (svc *Service) CancelJob(ctx context.Context, req *pb.CancelJobRequest) (*pb.CancelJobResponse, error)

CancelJob cancels a job

func (*Service) CleanJobs

func (svc *Service) CleanJobs(ctx context.Context, req *pb.CleanJobsRequest) (*pb.CleanJobsResponse, error)

CleanJobs remove all the finished job from the database

func (*Service) ConfigConsolidation

func (svc *Service) ConfigConsolidation(ctx context.Context, req *pb.ConfigConsolidationRequest) (*pb.ConfigConsolidationResponse, error)

ConfigConsolidation configures the consolidation parameters associated to a variable

func (*Service) Consolidate

func (svc *Service) Consolidate(ctx context.Context, req *pb.ConsolidateRequest) (*pb.ConsolidateResponse, error)

Consolidate starts a consolidation job

func (*Service) ContinueJob added in v0.3.0

func (svc *Service) ContinueJob(ctx context.Context, req *pb.ContinueJobRequest) (*pb.ContinueJobResponse, error)

ContinueJob continue a waiting job

func (*Service) CreateAOI

func (svc *Service) CreateAOI(ctx context.Context, req *pb.CreateAOIRequest) (*pb.CreateAOIResponse, error)

CreateAOI creates an aoi

func (*Service) CreateGrid added in v0.3.0

func (svc *Service) CreateGrid(stream pb.Geocube_CreateGridServer) error

CreateGrid

func (*Service) CreateLayout

func (svc *Service) CreateLayout(ctx context.Context, req *pb.CreateLayoutRequest) (*pb.CreateLayoutResponse, error)

CreateLayout creates a layout

func (*Service) CreatePalette

func (svc *Service) CreatePalette(ctx context.Context, req *pb.CreatePaletteRequest) (*pb.CreatePaletteResponse, error)

CreatePalette creates a palette

func (*Service) CreateRecords

func (svc *Service) CreateRecords(ctx context.Context, req *pb.CreateRecordsRequest) (*pb.CreateRecordsResponse, error)

CreateRecords creates a batch of records with a common aoi

func (*Service) CreateVariable

func (svc *Service) CreateVariable(ctx context.Context, v *pb.CreateVariableRequest) (*pb.CreateVariableResponse, error)

CreateVariable creates the definition of a variable

func (*Service) DeleteGrid added in v0.3.0

func (svc *Service) DeleteGrid(ctx context.Context, req *pb.DeleteGridRequest) (*pb.DeleteGridResponse, error)

DeleteGrid

func (*Service) DeleteInstance

func (svc *Service) DeleteInstance(ctx context.Context, req *pb.DeleteInstanceRequest) (*pb.DeleteInstanceResponse, error)

DeleteInstance deletes the instance if not used anymore

func (*Service) DeleteLayout added in v0.3.0

func (svc *Service) DeleteLayout(ctx context.Context, req *pb.DeleteLayoutRequest) (*pb.DeleteLayoutResponse, error)

DeleteLayout

func (*Service) DeleteRecords

func (svc *Service) DeleteRecords(ctx context.Context, req *pb.DeleteRecordsRequest) (*pb.DeleteRecordsResponse, error)

DeleteRecords deletes a batch of records iif no dataset has a reference on

func (*Service) DeleteVariable

func (svc *Service) DeleteVariable(ctx context.Context, req *pb.DeleteVariableRequest) (*pb.DeleteVariableResponse, error)

DeleteVariable deletes the variable and all its instances iif not used anymore

func (*Service) FindContainerLayouts added in v0.5.1

func (svc *Service) FindContainerLayouts(req *pb.FindContainerLayoutsRequest, stream pb.Geocube_FindContainerLayoutsServer) error

FindContainerLayouts find the layouts of the containers defined by several identifiers

func (*Service) GetAOI

func (svc *Service) GetAOI(ctx context.Context, req *pb.GetAOIRequest) (*pb.GetAOIResponse, error)

GetAOI retrieves an aoi

func (*Service) GetConsolidationParams

GetConsolidationParams reads the configuration parameters associated to a variable

func (*Service) GetCube

func (svc *Service) GetCube(req *pb.GetCubeRequest, stream pb.Geocube_GetCubeServer) error

GetCube retrieves, rescale and reproject datasets and serves them as a cube

func (*Service) GetJob

func (svc *Service) GetJob(ctx context.Context, req *pb.GetJobRequest) (*pb.GetJobResponse, error)

GetJob retrieves a job

func (*Service) GetRecords added in v1.0.1

func (svc *Service) GetRecords(req *pb.GetRecordsRequest, stream pb.Geocube_GetRecordsServer) error

GetRecords retrieves a ilist of records from their ids

func (*Service) GetVariable

func (svc *Service) GetVariable(ctx context.Context, req *pb.GetVariableRequest) (*pb.GetVariableResponse, error)

GetVariable retrieves the definition of the variable with the given id

func (*Service) GetXYZTile

func (svc *Service) GetXYZTile(ctx context.Context, req *pb.GetTileRequest) (*pb.GetTileResponse, error)

GetXYZTile TODO

func (*Service) IndexDatasets

func (svc *Service) IndexDatasets(ctx context.Context, req *pb.IndexDatasetsRequest) (*pb.IndexDatasetsResponse, error)

IndexDatasets adds datasets in database

func (*Service) InstantiateVariable

func (svc *Service) InstantiateVariable(ctx context.Context, req *pb.InstantiateVariableRequest) (*pb.InstantiateVariableResponse, error)

InstantiateVariable creates an instance of the variable

func (*Service) ListGrids added in v0.3.0

func (svc *Service) ListGrids(ctx context.Context, req *pb.ListGridsRequest) (*pb.ListGridsResponse, error)

ListGrids

func (*Service) ListJobs

func (svc *Service) ListJobs(ctx context.Context, req *pb.ListJobsRequest) (*pb.ListJobsResponse, error)

ListJobs list job with name like nameLike

func (*Service) ListLayouts

func (svc *Service) ListLayouts(ctx context.Context, req *pb.ListLayoutsRequest) (*pb.ListLayoutsResponse, error)

ListLayouts lists layouts with name like nameLike

func (*Service) ListRecords

func (svc *Service) ListRecords(req *pb.ListRecordsRequest, stream pb.Geocube_ListRecordsServer) error

ListRecords retrieves all the records with respect to the request

func (*Service) ListVariables

func (svc *Service) ListVariables(req *pb.ListVariablesRequest, stream pb.Geocube_ListVariablesServer) error

ListVariables lists variables with search parameters

func (*Service) RemoveRecordsTags

func (svc *Service) RemoveRecordsTags(ctx context.Context, req *pb.RemoveRecordsTagsRequest) (*pb.RemoveRecordsTagsResponse, error)

AddRecordsTags removes tags on list of records

func (*Service) RetryJob

func (svc *Service) RetryJob(ctx context.Context, req *pb.RetryJobRequest) (*pb.RetryJobResponse, error)

RetryJob retries a failed job

func (*Service) TileAOI

func (svc *Service) TileAOI(req *pb.TileAOIRequest, stream pb.Geocube_TileAOIServer) error

TileAOI creates tiles from an aoi

func (*Service) UpdateInstance

func (svc *Service) UpdateInstance(ctx context.Context, req *pb.UpdateInstanceRequest) (*pb.UpdateInstanceResponse, error)

UpdateInstance updates the name and metadata of the instance with the given id

func (*Service) UpdateVariable

func (svc *Service) UpdateVariable(ctx context.Context, req *pb.UpdateVariableRequest) (*pb.UpdateVariableResponse, error)

UpdateVariable updates a variable

func (*Service) Version

func (svc *Service) Version(ctx context.Context, req *pb.GetVersionRequest) (*pb.GetVersionResponse, error)

Version returns version of the geocube

type ServiceAdmin

type ServiceAdmin struct {
	pb.UnimplementedAdminServer
	// contains filtered or unexported fields
}

ServiceAdmin is the GRPC service

func NewAdmin

func NewAdmin(gsvca GeocubeServiceAdmin) *ServiceAdmin

NewAdmin returns a new GRPC ServiceAdmin connected to an admin Service

func (*ServiceAdmin) DeleteDatasets

DeleteDatasets implements AdminServer

func (*ServiceAdmin) TidyDB

func (svc *ServiceAdmin) TidyDB(ctx context.Context, req *pb.TidyDBRequest) (*pb.TidyDBResponse, error)

TidyDB implements AdminServer

func (*ServiceAdmin) UpdateDatasets

UpdateDatasets implements AdminServer

Jump to

Keyboard shortcuts

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