View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Jesse Vincent > Prophet-0.69_01 > Prophet::Replica::prophet



Annotate this POD


New  6
Open  2
View/Report Bugs
Source   Latest Release: Prophet-0.751

Replica Format ^


        /records (optional?)
            /<record type> (for resolution is actually _prophet-resolution-<cas-key>)
                /<record uuid> which is a file containing a list of 0 or more rows
                    last-changed-sequence-no : cas key
            index which has records:
                each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key
            /content (optional?)
                /_prophet-resolution-<cas-key>   (cas-key == a hash the conflicting change)
                    /<record uuid>  (record uuid == the originating replica)
                        last-changed-sequence-no : <cas key to the content of the resolution>
                index which has records:
                    each record is : local-replica-seq-no : original-uuid : original-seq-no : cas key

Inside the top level directory for the mirror, you'll find a directory named as a hex-encoded UUID. This directory is the root of the published replica. The uuid uniquely identifes the database being replicated. All replicas of this database will share the same UUID.

Inside the <db-uuid> directory, are a set of files and directories that make up the actual content of the database replica:


Contains the replica's hex-encoded UUID.


Contains a single integer that defines the replica format.

The current replica version is 1.


Contains a single integer, the replica's most recent sequence number.


The cas directory holds changesets and records, each keyed by a hex-encoded hash of the item's content. Inside the cas directory, you'll find a two-level deep directory tree of single-character hex digits. You'll find the changeset with the sha1 digest f4b7489b21f8d107ad8df78750a410c028abbf6c inside cas/changesets/f/4/f4b7489b21f8d107ad8df78750a410c028abbf6c.

You'll find the record with the sha1 digest dd6fb674de879a1a4762d690141cdfee138daf65 inside cas/records/d/d/dd6fb674de879a1a4762d690141cdfee138daf65.

TODO: define the format for changesets and records


Files inside the records directory are index files which list off all published versions of a record and the key necessary to retrieve the record from the content-addressed store.

Inside the records directory, you'll warn "Got types ".join(',',@types);find directories named for each type in your database. Inside each type directory, you'll find a two-level directory tree of single hexadecimal digits. You'll find the record with the type <Foo> and the UUID 29A3CA16-03C5-11DD-9AE0-E25CFCEE7EC4 stored in


The format of record files is:

    <unsigned-long-int: last-changed-sequence-no><40 chars of hex: cas key>

The file is sorted in asecnding order by revision id.


The changesets.idx file lists each changeset in this replica and provides an index into the content-addressed storage to fetch the content of the changeset.

The format of record files is:

    <unsigned-long-int: sequence-no><16 bytes: changeset original source uuid><unsigned-long-int: changeset original source sequence no><16 bytes: cas key - sha1 sum of the changeset's content>

The file is sorted in ascending order by revision id.



Open a connection to the prophet replica source identified by $self-url>.


Returns this replica's version.


Sets the replica's version to the given integer.


Return the replica's UUID

Internals of record handling ^

changesets_for_record { uuid => $uuid, type => $type, limit => $int }

Returns an ordered set of changeset objects for all changesets containing changes to this object.

Note that changesets may include changes to other records

If "limit" is specified, only returns that many changesets (starting from record creation).

syntax highlighting: