Document::Transform::Role::Backend - Interface role to be consumed by backends
version 1.110530
package MyBackend; use Moose; sub fetch_document_from_key { } sub fetch_transform_from_key { } sub fetch_document_from_transform { } sub fetch_transform_from_document { } sub store_document { } sub store_transform { } sub has_document { } sub has_transform { } sub is_same_document { } sub is_same_transform { } sub document_constraint { } sub transform_constraint { } with 'Document::Transform::Role::Backend'; 1;
Want to manage the backend to some other NoSQL database? Then you'll want to consume this role and implement the needed functions. Generally, the store functions should take data structures that conform the Types listed in "document_constraint"/"transform_constraint" and the fetch methods should return those as well.
document_id_key/transform_id_key/reference_id_key are provided to bring more configurability into the equation when fetching documents and transforms. Backends are free to ignore these attributes or provide defaults for them. Generally, the backends should use these attributes.
Transforms and documents should be linked either through the NoSQL database supported references or soft references that require a second lookup. Either way, fetch_document_from_transform can either simply access the referenced document or fetch it from a second lookup, it doesn't really matter. fetch_transform_from_document is only provided for completeness sake, but isn't actually used in the implementation. Two-way resolution of references might not fit your document schema, so an empty subroutine can be safely provided. I reserve the right to make this two-way communication required in the future.
This method must accept a key and should return a Transform defined by "transform_constraint"
This method must accept a key and should return a Document defined by "document_constraint"
This method must accept a Document (however that is defined by "document_constraint") and should return a Transform (defined by "transform_constraint")
This method must accept a Transform defined by "transform_constraint" and should return a Document defined by "document_constraint"
This method should accept a Transform defined by "transform_constraint" and store it in the backend.
This method should accept a Document defined by "document_constraint" and store it in the backend.
This method must accept a key and return a Bool on if the document exists in the store.
This method must accept a key and return a Bool on if the transform exists in the store.
This method must accept two Document arguments, compare them, and must return Bool if they are the same
This method must accept two Transform arguments, compare them, and must return Bool if they are the same
In order for Document::Transform to properly constraint imports on the front-end, it needs a constraint to check against. This method or attribute must return a Moose::Meta::TypeConstraint object that constrains those methods that accept documents as arguments.
In order for Document::Transform to properly constraint imports on the front-end, it needs a constraint to check against. This method or attribute must return a Moose::Meta::TypeConstraint object that constrains those methods that accept transforms as arguments.
is: ro, isa: Str
This holds the attribute key that should be used when attempting to fetch the document.
This holds the attribute key that should be used when attempting to fetch the transform.
This holds the key that should be used when attempting to fetch a referenced document from a transform.
Nicholas R. Perez <nperez@cpan.org>
This software is copyright (c) 2010 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Document::Transform, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Document::Transform
CPAN shell
perl -MCPAN -e shell install Document::Transform
For more information on module installation, please visit the detailed CPAN module installation guide.