⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 structure

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻
字号:
This file describes the design, layouts, and file formats of alibsvn_fs_fs repository.Design------In FSFS, each committed revision is represented as an immutable filecontaining the new node-revisions, contents, and changed-pathinformation for the revision, plus a second, changeable filecontaining the revision properties.In contrast to the BDB back end, the contents of recent revision offiles are stored as deltas against earlier revisions, instead of theother way around.  This is less efficient for common-case checkouts,but brings greater simplicity and robustness, as well as theflexibility to make commits work without write access to existingrevisions.  Skip-deltas and delta combination mitigate the checkoutcost.In-progress transactions are represented with a prototype rev filecontaining only the new text representations of files (appended to aschanged file contents come in), along with a separate file for eachnode-revision, directory representation, or property representationwhich has been changed or added in the transaction.  During the finalstage of the commit, these separate files are marshalled onto the endof the prototype rev file to form the immutable revision file.Layout of the FS directory--------------------------The layout of the FS directory (the "db" subdirectory of therepository) is:  revs                Subdirectory containing revs    <revnum>          File containing rev <revnum>  revprops            Subdirectory containing rev-props    <revnum>          File containing rev-props for <revnum>  transactions        Subdirectory containing transactions    <txnid>.txn       Directory containing transaction <txnid>  locks               Subdirectory containing locks    partial-digest    Subdirectory named for first 3 letters of an MD5 digest      <digest>        File containing locks/children for path with <digest>  current             File specifying current revision  write-lock          Lockfile for commitsFiles in the revprops directory are in the hash dump format used bysvn_hash_write.The format of the "current" file is a single line of the form"<youngest-revision> <next-node-id> <next-copy-id>\n" giving theyoungest revision, the next unique node-ID, and the next uniquecopy-ID for the repository.The "write-lock" file is an empty file which is locked before thefinal stage of a commit and unlocked after the new "current" file hasbeen moved into place to indicate that a new revision is present.Node-revision IDs-----------------In order to support efficient lookup of node-revisions by their IDsand to simplify the allocation of fresh node-IDs during a transaction,we treat the fields of a node-ID in new and interesting ways.Within a revision file, node-revs have a txn-id field of the form"r<rev>/<offset>", to support easy lookup.  The node-id and copy-idfields are unique base36 values as in the BDB implementation.New node-revision IDs assigned within a transaction have the txn-idfield of "t<txnid>".  The node-id or copy-id field may be base36values if the node-revision is derived from a pre-existing node and/orcopy; if the node-revision must have a freshly-assigned node-id orcopy-id, it uses "_" followed by a base36 unique to the transaction.During the final phase of a commit, node-revision IDs are rewritten tohave unique node-ID and copy-ID fields and to have "r<rev>/<offset>"txn-id fields.The temporary assignment of node-ID and copy-ID fields hasimplications for svn_fs_compare_ids and svn_fs_check_related.  The IDs_1.0.t1 is not related to the ID _1.0.t2 even though they have thesame node-ID, because temporary node-IDs are restricted in scope tothe transactions they belong to.Copy-IDs and copy roots-----------------------Copy-IDs are assigned in the same manner as they are in the BDBimplementation:  * A node-rev resulting from a creation operation (with no copy    history) receives the copy-ID of its parent directory.  * A node-rev resulting from a copy operation receives a fresh    copy-ID, as one would expect.  * A node-rev resulting from a modification operation receives a    copy-ID depending on whether its predecessor derives from a    copy operation or whether it derives from a creation operation    with no intervening copies:      - If the predecessor does not derive from a copy, the new        node-rev receives the copy-ID of its parent directory.  If the        node-rev is being modified through its created-path, this will        be the same copy-ID as the predecessor node-rev has; however,        if the node-rev is being modified through a copied ancestor        directory (i.e. we are performing a "lazy copy"), this will be        a different copy-ID.      - If the predecessor derives from a copy and the node-rev is        being modified through its created-path, the new node-rev        receives the copy-ID of the predecessor.      - If the predecessor derives from a copy and the node-rev is not        being modified through its created path, the new node-rev        receives a fresh copy-ID.  This is called a "soft copy"        operation, as distinct from a "true copy" operation which was        actually requested through the svn_fs interface.  Soft copies        exist to ensure that the same <node-ID,copy-ID> pair is not        used twice within a transaction.Unlike the BDB implementation, we do not have a "copies" table.Instead, each node-revision record contains a "copyroot" fieldidentifying the node-rev resulting from the true copy operation mostproximal to the node-rev.  If the node-rev does not itself derive froma copy operation, then the copyroot field identifies the copy of anancestor directory; if no ancestor directories derive from a copyoperation, then the copyroot field identifies the root directory ofrev 0.Revision file format--------------------A revision file contains a concatenation of various kinds of data:  * Text and property representations  * Node-revisions  * At the end, the changed-path data  * Two offsets at the very endA representation begins with a line containing either "PLAIN\n" or"DELTA\n" or "DELTA <rev> <offset> <length>\n", where <rev>, <offset>,and <length> give the location of the delta base of the representationand the amount of data it contains (not counting the header ortrailer).  If no base location is given for a delta, the base is theempty stream.  After the initial line comes raw svndiff data, followedby a cosmetic trailer "ENDREP\n".If the a representation is for the text contents of a directory node,the expanded contents are in hash dump format mapping entry names to"<type> <id>" pairs, where <type> is "file" or "dir" and <id> givesthe ID of the child node-rev.If a representation is for a property list, the expanded contents arein the form of a dumped hash map mapping property names to propertyvalues.The marshalling syntax for node-revs is a series of fields terminatedby a blank line.  Fields have the syntax "<name>: <value>\n", where<name> is a symbolic field name (each symbolic name is used only oncein a given node-rev) and <value> is the value data.  Unrecognizedfields are ignored, for extensibility.  The following fields aredefined:  id        The ID of the node-rev  type      "file" or "dir"  pred      The ID of the predecessor node-rev  count     Count of node-revs since the base of the node  text      "<rev> <offset> <length> <size> <digest>" for text rep  props     "<rev> <offset> <length> <size> <digest>" for props rep            <rev> and <offset> give location of rep            <length> gives length of rep, sans header and trailer            <size> gives size of expanded rep            <digest> gives hex MD5 digest of expanded rep  cpath     FS pathname node was created at  copyfrom  "<rev> <path>" of copyfrom data  copyroot  "<rev> <created-path>" of the root of this copyThe predecessor of a node-rev crosses both soft and true copies;together with the count field, it allows efficient determination ofthe base for skip-deltas.  The first node-rev of a node contains no"pred" field.  A node-revision with no properties may omit the "props"field.  A node-revision with no contents (a zero-length file or anempty directory) may omit the "text" field.  In a node-revisionresulting from a true copy operation, the "copyfrom" field gives thecopyfrom data.  The "copyroot" field identifies the root node-revisionof the copy; it may be omitted if the node-rev is its own copy root(as is the case for node-revs with copy history, and for the root nodeof revision 0).  Copy roots are identified by revision andcreated-path, not by node-rev ID, because a copy root may be anode-rev which exists later on within the same revision file, meaningits offset is not yet known.The changed-path data is represented as a series of changed-pathitems, each consisting of two lines.  The first line has the format"<id> <action> <text-mod> <prop-mod> <path>\n", where <id> is thenode-rev ID of the new node-rev, <action> is "add", "delete","replace", or "modify", <text-mod> and <prop-mod> are "true" or"false" indicating whether the text and/or properties changed, and<path> is the changed pathname.  For deletes, <id> is the node-rev IDof the deleted node-rev, and <text-mod> and <prop-mod> are always"false".  The second line has the format "<rev> <path>\n" containingthe node-rev's copyfrom information if it has any; if it does not, thesecond line is blank.At the very end of a rev file is a pair of lines containing"\n<root-offset> <cp-offset>\n", where <root-offset> is the offset ofthe root directory node revision and <cp-offset> is the offset of thechanged-path data.All numbers in the rev file format are unsigned and are represented asASCII decimal.Transaction layout------------------A transaction directory has the following layout:  rev                        Prototype rev file with new text reps  rev-lock                   Lockfile for writing to the above  props                      Transaction props  next-ids                   Next temporary node-ID and copy-ID  changes                    Changed-path information so far  node.<nid>.<cid>           New node-rev data for node  node.<nid>.<cid>.props     Props for new node-rev, if changed  node.<nid>.<cid>.children  Directory contents for node-revThe prototype rev file is used to store the text representations asthey are received from the client.  To ensure that only one client iswriting to the file at a given time, the "rev-lock" file is locked forthe duration of each write.The two kinds of props files are both in hash dump format.The "next-ids" file contains a single line "<next-temp-node-id><next-temp-copy-id>\n" giving the next temporary node-ID and copy-IDassignments (without the leading underscores).The "children" file for a node-revision begins with a copy of the hashdump representation of the directory entries from the old node-rev (ora dump of the empty hash for new directories), and then an incrementalhash dump entry for each change made to the directory.The "changes" file contains changed-path entries in the same form asthe changed-path entries in a rev file, except that <id> and <action>may both be "reset" (in which case <text-mod> and <prop-mod> are bothalways "false") to indicate that all changes to a path should beconsidered undone.  Reset entries are only used during the final mergephase of a transaction.The node-rev files have the same format as node-revs in a revisionfile, except that the "text" and "props" fields are augmented asfollows:  * The "props" field may have the value "-1" if properties have    been changed and are contained in a "props" file within the    node-rev subdirectory.  * For directory node-revs, the "text" field may have the value    "-1" if entries have been changed and are contained in a    "contents" file in the node-rev subdirectory.  * For file node-revs, the "text" field may have the value "-1    <offset> <length> <size> <digest>" if the text representation is    within the prototype rev file.  * The "copyroot" field may have the value "-1 <created-path>" if the    copy root of the node-rev is part of the transaction in process.Locks layout------------------Locks in FSFS are stored in serialized hash format in files whosenames are MD5 digests of the FS path which the lock is associatedwith.  For the purposes of keeping directory inode usage down, thesedigest files live in subdirectories of the main lock directory whosenames are the first 3 characters of the digest filename.Also stored in the digest file for a given FS path are pointers toother digest files which contain information associated with other FSpaths that are our path's immediate children.To answer the question, "Does path FOO have a lock associated withit?", one need only generate the MD5 digest of FOO'sabsolute-in-the-FS path (say, 3b1b011fed614a263986b5c4869604e8), lookfor a file located like so:   /path/to/repos/locks/3b1/3b1b011fed614a263986b5c4869604e8And then see if that file contains lock information.To inquire about locks on children of the path FOO, you wouldreference the same path as above, but look for a list of children inthat file (instead of lock information).  Children are listed as MD5digests, too, so you would simply iterate over those digests andconsult the files they reference, and so on, recursively.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -