fetchTimestamp: Update timestamp file if needed

Description Usage Arguments Value

View source: R/fetchTimestamp.R

Description

fetchTimestamp updates a timestamp file if the local copy of a file is out of date relative to the data source. In practice, the desired definition of 'out of date' differs widely among data sources, sizes, and projects, so fetchTimestamp is a generic function with a method specific to each fetcher. Every fetchTimestamp method should write a timestamp file, or not, as required to achieve the desired make behavior. See fetchTimestampMethods and fetchTimestampHelpers for assistance in defining new fetchTimestamp methods. Also consider preferences.yaml and exceededTimeToLive() for additional options for managing data fetches.

'fetchTimestamp.sciencebase' gets the file timestamp from ScienceBase.

'fetchTimestamp.file' creates a timestamp file once, with file metadata and file contents that both match the timestamp of the viz data file. If the timestamp file already exists, it is only modified if the data file is updated.

'fetchTimestamp.url' checks a URL for a timestamp. The URL headers must include a 'last-modified' field; otherwise, this method breaks and you should write your own for the specific URL in question.

fetchTimestamp.fetcher superclass method catches missing implementation

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
fetchTimestamp(viz)

## S3 method for class 'sciencebase'
fetchTimestamp(viz)

## S3 method for class 'file'
fetchTimestamp(viz)

## S3 method for class 'url'
fetchTimestamp(viz)

## S3 method for class 'fetcher'
fetchTimestamp(viz)

Arguments

viz

the identifier for a fetch item in viz.yaml

Value

It doesn't matter what a fetchTimestamp method returns. It matters a lot more whether it creates/updates the timestamp file or not.


USGS-VIZLAB/vizlab documentation built on Nov. 20, 2017, 7:36 p.m.