summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2011-03-24 22:21:33 +0000
committerdakkar <dakkar@thenautilus.net>2011-03-24 22:21:33 +0000
commitcb0e593bad1973d9ad301ea4c10daa8f3d12d5aa (patch)
tree15e79b774445016fa1087c900adf0e204ec7ddbf
parentinit (diff)
downloadDeWeave-cb0e593bad1973d9ad301ea4c10daa8f3d12d5aa.tar.gz
DeWeave-cb0e593bad1973d9ad301ea4c10daa8f3d12d5aa.tar.bz2
DeWeave-cb0e593bad1973d9ad301ea4c10daa8f3d12d5aa.zip
broken first stab
-rw-r--r--lib/DeWeave/EDO.pm27
-rw-r--r--lib/DeWeave/Global.pm19
-rw-r--r--lib/DeWeave/WBO.pm56
3 files changed, 102 insertions, 0 deletions
diff --git a/lib/DeWeave/EDO.pm b/lib/DeWeave/EDO.pm
new file mode 100644
index 0000000..29a9cee
--- /dev/null
+++ b/lib/DeWeave/EDO.pm
@@ -0,0 +1,27 @@
+package DeWeave::EDO;
+use Moose;
+use namespace::autoclean;
+use MooseX::Types::Moose qw(Int Str Num);
+use JSON::Any;
+
+extends 'DeWeave::WBO';
+
+has cyhpertext => (
+ isa => Str,
+ required => 1,
+ is => 'ro',
+);
+
+has IV => (
+ isa => Str,
+ required => 1,
+ is => 'ro',
+);
+
+has hmac => (
+ isa => Str,
+ required => 1,
+ is => 'ro',
+);
+
+1;
diff --git a/lib/DeWeave/Global.pm b/lib/DeWeave/Global.pm
new file mode 100644
index 0000000..9e36bad
--- /dev/null
+++ b/lib/DeWeave/Global.pm
@@ -0,0 +1,19 @@
+package DeWeave::Global;
+use Moose;
+use namespace::autoclean;
+use MooseX::Types::Moose qw(Int Str Num);
+
+extends 'DeWeave::WBO';
+
+has storageVersion => (
+ isa => Num,
+ required => 1,
+ is => 'ro',
+);
+
+has syncID => (
+ isa => Str,
+ required => 1,
+ is => 'ro',
+);
+
diff --git a/lib/DeWeave/WBO.pm b/lib/DeWeave/WBO.pm
new file mode 100644
index 0000000..db89581
--- /dev/null
+++ b/lib/DeWeave/WBO.pm
@@ -0,0 +1,56 @@
+package DeWeave::WBO;
+use Moose;
+use namespace::autoclean;
+use MooseX::Types::Moose qw(Int Str Num);
+use JSON::Any;
+use Try::Tiny;
+
+has id => (
+ isa => Str,
+ required => 1,
+ is => 'ro',
+);
+
+has modified => (
+ isa => Num,
+ required => 1,
+ is => 'ro',
+);
+
+has sortindex => (
+ isa => Num,
+ required => 1,
+ is => 'ro',
+);
+
+has payload => (
+ isa => Str,
+ required => 1,
+ is => 'ro',
+);
+
+has ttl => (
+ isa => Int,
+ required => 0,
+ is => 'ro',
+);
+
+sub from_json {
+ my ($class,$json)=@_;
+
+ my $j = JSON::Any->new;
+
+ my $args = $j->decode($json);
+ if (exists $args->{payload}) {
+ try {
+ my $extra_args = $j->decode($args->{payload});
+
+ @$args{keys %$extra_args} =
+ values %$extra_args;
+ };
+ }
+
+ $class->new($args);
+}
+
+1;