NAME
Zing::Savepoint - Lookup Table Savepoint
ABSTRACT
Lookup Table Savepoint Construct
SYNOPSIS
use Zing::Lookup;
use Zing::Savepoint;
my $lookup = Zing::Lookup->new(name => 'users');
$lookup->set('user-12345')->set(username => 'u12345');
$lookup->set('user-12346')->set(username => 'u12346');
$lookup->set('user-12347')->set(username => 'u12347');
my $savepoint = Zing::Savepoint->new(lookup => $lookup);
# $savepoint->test;
DESCRIPTION
This package provides a savepoint mechanism for saving and restoring large Zing::Lookup indices. If a lookup has an associated savepoint it will be used to build the index on (Zing::Lookup) object construction automatically, however, creating the savepoint (saving the state of the index) needs to be done manually.
LIBRARIES
This package uses type constraints from:
ATTRIBUTES
This package has the following attributes:
lookup
lookup(Lookup)
This attribute is read-only, accepts (Lookup)
values, and is required.
METHODS
This package implements the following methods:
capture
capture() : HashRef
The capture method returns the relevant state properties from the lookup.
drop
drop() : Bool
The drop method removes the persisted savepoint.
metadata
metadata() : HashRef
The metadata method returns the cached metadata property for the lookup.
name
name() : Str
The name method returns the generated savepoint name.
position
position() : Int
The position method returns the cached position property for the lookup.
- position example #1
-
use Zing::Lookup; use Zing::Savepoint; my $lookup = Zing::Lookup->new(name => 'users'); my $savepoint = Zing::Savepoint->new(lookup => $lookup); $lookup->drop; $savepoint->drop; $lookup->set('user-12345')->set(username => 'u12345'); $lookup->set('user-12346')->set(username => 'u12346'); $lookup->set('user-12347')->set(username => 'u12347'); $savepoint->send; $savepoint->position;
recv
recv() : Any
The recv method returns the data (if any) associated with the savepoint.
repo
repo() : KeyVal
The repo method returns the Zing::KeyVal object used to manage the savepoint.
send
send() : HashRef
The send method caches and stores the data from "capture" as a savepoint and returns the data.
snapshot
snapshot() : HashRef
The snapshot method returns the cached snapshot property for the lookup.
test
test() : Bool
The test method checks whether the savepoint exists and returns truthy or falsy.
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".