dbda8d6ce9 2007-07-21 drh: <html> dbda8d6ce9 2007-07-21 drh: <head> dbda8d6ce9 2007-07-21 drh: <title>Fossil - Principles of Operation</title> dbda8d6ce9 2007-07-21 drh: </head> dbda8d6ce9 2007-07-21 drh: <body bgcolor="white"> dbda8d6ce9 2007-07-21 drh: <h1>Principles Of Operation</h1> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <p> dbda8d6ce9 2007-07-21 drh: This page attempts to define the foundational principals upon dbda8d6ce9 2007-07-21 drh: which Fossil is built. dbda8d6ce9 2007-07-21 drh: </p> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <ul> dbda8d6ce9 2007-07-21 drh: <li><p>A project consists of source files, wiki pages, and dbda8d6ce9 2007-07-21 drh: trouble tickets. All historical copies of all these dbda8d6ce9 2007-07-21 drh: entities are saved. The project maintains an audit dbda8d6ce9 2007-07-21 drh: trail.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>A project resides in one or more repositories. Each dbda8d6ce9 2007-07-21 drh: repository is administered and operates independently dbda8d6ce9 2007-07-21 drh: of the others.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>Each repository has both global and local state. The dbda8d6ce9 2007-07-21 drh: global state is common to all repositories (or at least dbda8d6ce9 2007-07-21 drh: has the potential to be shared in common when the dbda8d6ce9 2007-07-21 drh: repositories are fully synchronized). The local state dbda8d6ce9 2007-07-21 drh: for each repository is private to that repository. dbda8d6ce9 2007-07-21 drh: The global state represents the content of the project. dbda8d6ce9 2007-07-21 drh: The local state identifies the authorized users and dbda8d6ce9 2007-07-21 drh: access policies for a particular repository.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>The global state of a repository is an mostly unordered dbda8d6ce9 2007-07-21 drh: collection of files. Each file is named by dbda8d6ce9 2007-07-21 drh: its SHA256 hash. The name is encoded as a 52-digit dbda8d6ce9 2007-07-21 drh: base-32 number. In many contexts, the name can be dbda8d6ce9 2007-07-21 drh: abbreviated to a unique prefix. A five- or six-character dbda8d6ce9 2007-07-21 drh: prefix usually suffices to uniquely identify a file.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>Because files are named by their SHA256 hash, all files dbda8d6ce9 2007-07-21 drh: are immutable. Any change to the content of a file also dbda8d6ce9 2007-07-21 drh: changes the hash that forms the files name, thus dbda8d6ce9 2007-07-21 drh: creating a new file. Both the old original version of the dbda8d6ce9 2007-07-21 drh: file and the new change are preserved under different names.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>It is theoretically possible for two files with different dbda8d6ce9 2007-07-21 drh: content to share the same hash. But finding two such dbda8d6ce9 2007-07-21 drh: files is so incredibly difficult and unlikely that we dbda8d6ce9 2007-07-21 drh: consider it to be an impossibility.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>The files that comprise the global state of a repository dbda8d6ce9 2007-07-21 drh: consist of a header followed by optional content. Every dbda8d6ce9 2007-07-21 drh: file contains an RSA signature in the header. And every dbda8d6ce9 2007-07-21 drh: file contains a "file type" designator in the header. dbda8d6ce9 2007-07-21 drh: Additional information is also found in the header depending dbda8d6ce9 2007-07-21 drh: on the file type.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>The file that comprise the global state of a repository dbda8d6ce9 2007-07-21 drh: are the complete global state of that repository. The SQLite dbda8d6ce9 2007-07-21 drh: database that holds the repository contains additional information dbda8d6ce9 2007-07-21 drh: about linkages between files, but all of that added information dbda8d6ce9 2007-07-21 drh: can be discarded and reconstructed by scanning the content dbda8d6ce9 2007-07-21 drh: files.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>Two repositories for the same project can synchronize dbda8d6ce9 2007-07-21 drh: their global states simply by sharing files. The local dbda8d6ce9 2007-07-21 drh: state of repositories is not normally synchronized or dbda8d6ce9 2007-07-21 drh: shared.</p></li> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <li><p>The name of a file is its SHA256 hash in a base-32 dbda8d6ce9 2007-07-21 drh: encoding. The digits of the base-32 encode are as dbda8d6ce9 2007-07-21 drh: follows: dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <blockquote><b> dbda8d6ce9 2007-07-21 drh: 0123456789abcdefghjkmnpqrstuvwxy dbda8d6ce9 2007-07-21 drh: </b></blockquote> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: <p>The letters "o", "i", and "l" are omitted from the dbda8d6ce9 2007-07-21 drh: encoding character set to avoid confusion with the dbda8d6ce9 2007-07-21 drh: digits "0" and "1". On input, upper and lower case dbda8d6ce9 2007-07-21 drh: letters are treated the same, the letter "o" is dbda8d6ce9 2007-07-21 drh: interpreted as a zero ("0") and the letters "i" and dbda8d6ce9 2007-07-21 drh: "l" are interpreted as a one ("1"). The full name of dbda8d6ce9 2007-07-21 drh: a file is 52 characters long. The first 4 bits of the dbda8d6ce9 2007-07-21 drh: SHA256 has are repeated onto the end of the hash so that dbda8d6ce9 2007-07-21 drh: the last digit in the base-32 encoding will contain a dbda8d6ce9 2007-07-21 drh: full 5 bits. dbda8d6ce9 2007-07-21 drh: For convenience, files dbda8d6ce9 2007-07-21 drh: may often be abbreviated to a unique prefix and the dbda8d6ce9 2007-07-21 drh: repository will automatically expand the name to dbda8d6ce9 2007-07-21 drh: its full 52 characters. In practice, 5 or 6 dbda8d6ce9 2007-07-21 drh: characters are usually sufficient to give a unique dbda8d6ce9 2007-07-21 drh: name prefix to files even in the largest of projects.</p></li> dbda8d6ce9 2007-07-21 drh: </ul> dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: </body> dbda8d6ce9 2007-07-21 drh: </html>