Zing::Savepoint - Lookup Table Savepoint
Lookup Table Savepoint Construct
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;
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.
This package uses type constraints from:
Zing::Types
This package has the following attributes:
lookup(Lookup)
This attribute is read-only, accepts (Lookup) values, and is required.
(Lookup)
This package implements the following methods:
capture() : HashRef
The capture method returns the relevant state properties from the lookup.
# given: synopsis $savepoint->capture;
drop() : Bool
The drop method removes the persisted savepoint.
# given: synopsis $savepoint->drop;
metadata() : HashRef
The metadata method returns the cached metadata property for the lookup.
# given: synopsis $savepoint->metadata;
name() : Str
The name method returns the generated savepoint name.
# given: synopsis $savepoint->name;
position() : Int
The position method returns the cached position property for the lookup.
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() : Any
The recv method returns the data (if any) associated with the savepoint.
# given: synopsis $savepoint->recv;
repo() : KeyVal
The repo method returns the Zing::KeyVal object used to manage the savepoint.
# given: synopsis $savepoint->repo;
send() : HashRef
The send method caches and stores the data from "capture" as a savepoint and returns the data.
# given: synopsis $savepoint->send;
snapshot() : HashRef
The snapshot method returns the cached snapshot property for the lookup.
# given: synopsis $savepoint->snapshot;
test() : Bool
The test method checks whether the savepoint exists and returns truthy or falsy.
# given: synopsis $savepoint->repo->drop('state'); $savepoint->test;
# given: synopsis $savepoint->send; $savepoint->test;
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
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".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Zing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zing
CPAN shell
perl -MCPAN -e shell install Zing
For more information on module installation, please visit the detailed CPAN module installation guide.