internal

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version    = "??"
	Commit     = "??"
	CommitDate = "??"
	TreeState  = "??"
)

Set via ldflags

Functions

func CanWrite

func CanWrite(path string) bool

func Exists

func Exists(path string) bool

func FetchConcurrent

func FetchConcurrent(reqs chan DownloadRequest, fetcherFactory FetcherFactory, concurrency int) (chan DownloadResult, error)

func FetchConcurrentWithContext

func FetchConcurrentWithContext(ctx context.Context, reqs chan DownloadRequest, fetcherFactory FetcherFactory, concurrency int) (chan DownloadResult, error)

func IsDir

func IsDir(path string) bool

func ResolveEDLToken added in v0.4.0

func ResolveEDLToken(token string) string

func SplitChecksum added in v0.2.3

func SplitChecksum(s string) (string, string, error)

Types

type CMRError added in v0.2.3

type CMRError struct {
	RequestID string
	Status    string
	Err       error
}

func (*CMRError) Error added in v0.2.3

func (e *CMRError) Error() string

type CMRSearchAPI

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

func NewCMRSearchAPI

func NewCMRSearchAPI(logger *log.Logger) *CMRSearchAPI

func (*CMRSearchAPI) Get

func (*CMRSearchAPI) SearchCollections

func (api *CMRSearchAPI) SearchCollections(ctx context.Context, params *SearchCollectionParams) (ScrollResult[Collection], error)

func (*CMRSearchAPI) SearchFacets added in v0.2.1

func (api *CMRSearchAPI) SearchFacets(ctx context.Context, val string, types []string) (ScrollResult[Facet], error)

func (*CMRSearchAPI) SearchGranules

func (api *CMRSearchAPI) SearchGranules(ctx context.Context, params *SearchGranuleParams) (ScrollResult[Granule], error)

type Collection

type Collection map[string]string

type CollectionItem added in v0.3.0

type CollectionItem struct {
	ConceptID    string
	GranuleCount int64
	Title        string
}

type CollectionResult

type CollectionResult = ScrollResult[Collection]

type DownloadRequest

type DownloadRequest struct {
	URL         string
	ChecksumAlg string
	Checksum    string
	Dest        string
}

type DownloadResult

type DownloadResult struct {
	URL      string
	Path     string
	Checksum string
	Duration time.Duration
	Size     int64
	Err      error
}

type Facet added in v0.2.1

type Facet struct {
	Score  float64 `json:"score"`
	Type   string  `json:"type"`
	Fields string  `json:"fields"`
	Value  string  `json:"value"`
}

type FailedDownload added in v0.2.2

type FailedDownload struct {
	RequestID    string
	ResponseBody string
	Status       string
	URL          string
}

func (*FailedDownload) Error added in v0.2.2

func (e *FailedDownload) Error() string

type FetchError

type FetchError struct {
	Request DownloadRequest
	Err     error
}

func (*FetchError) Error

func (e *FetchError) Error() string

type FetchPoolFunc

type FetchPoolFunc = func(reqs chan DownloadRequest, concurrency int) (chan DownloadResult, error)

type Fetcher

type Fetcher func(ctx context.Context, url string, w io.Writer) (int64, error)

type FetcherFactory added in v0.2.2

type FetcherFactory func() (Fetcher, error)

type Granule

type Granule struct {
	Name          string            `json:"name"`
	Size          string            `json:"size"`
	Checksum      string            `json:"checksum"`
	ChecksumAlg   string            `json:"checksum_alg"`
	GetDataURL    string            `json:"download_url"`
	GetDataDAURL  string            `json:"download_direct_url"`
	NativeID      string            `json:"native_id"`
	RevisionID    string            `json:"revision_id"`
	ConceptID     string            `json:"concept_id"`
	Collection    string            `json:"collection"`
	DayNightFlag  string            `json:"daynight"`
	TimeRange     []string          `json:"timerange"`
	BoundingBox   []string          `json:"boundingbox"`
	ProviderDates map[string]string `json:"provider_dates"`
}

type GranuleResult

type GranuleResult = ScrollResult[Granule]

type HTTPFetcher

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

HTTPFetch is a Fetcher that supports basic file fetching. It supports netrc for authentication redirects and uses an in-memory cookie jar to save authentication cookies provided by authentication services such as NASA Einternal.

func NewHTTPFetcher

func NewHTTPFetcher(netrc bool, edlToken string) (*HTTPFetcher, error)

func (*HTTPFetcher) Fetch

func (f *HTTPFetcher) Fetch(ctx context.Context, url string, w io.Writer) (int64, error)

Fetch url to destdir using url's basename as the filename and update hash with the file bytes as they are read.

type Provider added in v0.3.0

type Provider struct {
	ID           string
	Collections  []CollectionItem
	GranuleCount int64
}

func GetProviderHoldings added in v0.3.0

func GetProviderHoldings() ([]Provider, error)

type ProviderCollection added in v0.3.0

type ProviderCollection struct {
}

type ScrollResult

type ScrollResult[T Granule | Collection | gjson.Result | Facet] struct {
	Ch chan T
	// contains filtered or unexported fields
}

func (*ScrollResult[T]) Err

func (r *ScrollResult[T]) Err() error

func (ScrollResult[T]) Hits

func (r ScrollResult[T]) Hits() int

type SearchCollectionParams

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

SearchCollectionParams is a builder for collection search query params

func NewSearchCollectionParams

func NewSearchCollectionParams() *SearchCollectionParams

func (*SearchCollectionParams) CloudHosted

func (*SearchCollectionParams) DataType added in v0.2.2

func (*SearchCollectionParams) GranulesAdded

func (*SearchCollectionParams) HasGranules

func (*SearchCollectionParams) Instruments

func (p *SearchCollectionParams) Instruments(names ...string) *SearchCollectionParams

func (*SearchCollectionParams) Keyword

func (*SearchCollectionParams) Platforms

func (p *SearchCollectionParams) Platforms(names ...string) *SearchCollectionParams

func (*SearchCollectionParams) Providers

func (p *SearchCollectionParams) Providers(names ...string) *SearchCollectionParams

func (*SearchCollectionParams) ShortNames added in v0.2.1

func (p *SearchCollectionParams) ShortNames(names ...string) *SearchCollectionParams

func (*SearchCollectionParams) SortBy

func (*SearchCollectionParams) Standard

func (*SearchCollectionParams) Title

func (*SearchCollectionParams) UpdatedSince

type SearchGranuleParams

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

SearchGranuleParams is a builder for collection search query params

func NewSearchGranuleParams

func NewSearchGranuleParams() *SearchGranuleParams

func (*SearchGranuleParams) BoundingBox

func (p *SearchGranuleParams) BoundingBox(vals []float64) *SearchGranuleParams

func (*SearchGranuleParams) Circle

func (p *SearchGranuleParams) Circle(vals []float64) *SearchGranuleParams

func (*SearchGranuleParams) Collections added in v0.2.2

func (p *SearchGranuleParams) Collections(id ...string) *SearchGranuleParams

func (*SearchGranuleParams) DayNightFlag

func (p *SearchGranuleParams) DayNightFlag(name string) *SearchGranuleParams

func (*SearchGranuleParams) Filenames added in v0.2.2

func (p *SearchGranuleParams) Filenames(name ...string) *SearchGranuleParams

func (*SearchGranuleParams) NativeIDs added in v0.2.2

func (p *SearchGranuleParams) NativeIDs(id ...string) *SearchGranuleParams

func (*SearchGranuleParams) Point

func (*SearchGranuleParams) Polygon

func (p *SearchGranuleParams) Polygon(vals []float64) *SearchGranuleParams

func (*SearchGranuleParams) ShortNames added in v0.2.2

func (p *SearchGranuleParams) ShortNames(name ...string) *SearchGranuleParams

func (*SearchGranuleParams) Timerange

func (p *SearchGranuleParams) Timerange(start time.Time, end *time.Time) *SearchGranuleParams

type TimeRange

type TimeRange struct {
	Start time.Time
	End   *time.Time
}

type TimeRangeValue

type TimeRangeValue struct {
	Start *time.Time
	End   *time.Time
}

func (*TimeRangeValue) Set

func (tr *TimeRangeValue) Set(val string) error

func (*TimeRangeValue) String

func (v *TimeRangeValue) String() string

func (*TimeRangeValue) Type

func (v *TimeRangeValue) Type() string

Jump to

Keyboard shortcuts

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