# Module: Storage

Author:
  - pmeijer / https://github.com/pmeijer

### Type Definitions

#### CommitHash

  Unique SHA-1 hash for commit object.

  ##### Type:

  - string

  ##### Example

      '#5496cf226542fcceccf89056f0d27564abc88c99'

#### CommitObject

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `_id` | module:Storage~CommitHash | Hash of the commit object, a.k.a commitHash.
  `root` | module:Core~ObjectHash | Hash of the associated root object, a.k.a. rootHash.
  `parents` | Array.<module:Storage~CommitHash> | Commits from where this commit evolved.
  `time` | number | When the commit object was created Date.now().
  `message` | string | Commit message.
  `updater` | Array.<string> | Commit message.
  `type` | string | 'commit'

  ##### Example

      {
        _id: '#5496cf226542fcceccf89056f0d27564abc88c99',
        root: '#04009ecd1e68117cd3e9d39c87aadd9ed1ee5cb3',
        parents: ['#87d9fd309ec6a5d84776d7731ce1f1ab2790aac2']
        updater: ['guest'],
        time: 1430169614741,
        message: "createChildren({\"/1008889918/1998840078\":\"/1182870936/737997118/1736829087/1966323860\"})",
        type: 'commit'
      }

#### CommitResult

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `hash` | module:Storage~CommitHash | The commitHash for the commit.
  `status` | string | 'SYNCED', 'FORKED', 'CANCELED', undefined

  ##### Examples

      {
        status: 'SYNCED',
        hash: '#someHash'
      }

      {
        hash: '<hash from makeCommit with no branch provided>'
      }

#### PatchObject

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `_id` | module:Core~ObjectHash | Hash of the expected result object.
  `base` | module:Core~ObjectHash | Hash of the base object where the patch should be applied.
  `type` | string | 'patch'.
  `patch` | object | The patch instructions (based on RFC6902).

  ##### Example

      {
        _id: '#5496cf226542fcceccf89056f0d27564abc88c99',
        base: '#04009ecd1e68117cd3e9d39c87aadd9ed1ee5cb3',
        type: 'patch',
        patch: [{op: 'add', path: '/atr/new', value: 'value'}]
      }

#### Search results