VuFindHarvest API Documentation

StateManager
in package

OAI-PMH State Manager (for persisting harvest state)

This class actually serves two distinct functions:

Long-term state management: remembering/retrieving the end date of the most recent harvest through saveDate()/loadDate().

Short-term state management: remembering resumption tokens to allow for continuation of an interrupted harvest through saveState()/loadState().

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$lastHarvestFile  : string
File for tracking last harvest date
$lastStateFile  : string
File for tracking last harvest state (for continuing interrupted connection).
__construct()  : mixed
Constructor.
clearState()  : void
Clear the state most recently saved to saveState().
loadDate()  : string
Retrieve the date from the "last harvested" file and use it as our start date if it is available.
loadState()  : array<string|int, mixed>|bool
Load the last saved harvest state. Returns an array of [set, resumption token, start date] if found; false otherwise.
saveDate()  : void
Save a date to the "last harvested" file.
saveState()  : void
Save a harvest state.

Properties

$lastHarvestFile

File for tracking last harvest date

protected string $lastHarvestFile

$lastStateFile

File for tracking last harvest state (for continuing interrupted connection).

protected string $lastStateFile

Methods

__construct()

Constructor.

public __construct(string $basePath) : mixed
Parameters
$basePath : string

Directory to contain state files

Return values
mixed

clearState()

Clear the state most recently saved to saveState().

public clearState() : void
Return values
void

loadDate()

Retrieve the date from the "last harvested" file and use it as our start date if it is available.

public loadDate() : string
Return values
string

loadState()

Load the last saved harvest state. Returns an array of [set, resumption token, start date] if found; false otherwise.

public loadState() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

saveDate()

Save a date to the "last harvested" file.

public saveDate(string $date) : void
Parameters
$date : string

Date to save.

Return values
void

saveState()

Save a harvest state.

public saveState(string $set, string $token, string $startDate, string $harvestEndDate) : void
Parameters
$set : string

Set being harvested

$token : string

Current resumption token

$startDate : string

Start date of harvest

$harvestEndDate : string

End date of harvest

Return values
void

Search results