append = async (data, options = { referencesCount: 0 }) => {
    const task = async () => {
      // 1. Prepare entry
      // 2. Authorize entry
      // 3. Store entry
      // 4. return Entry

      // Get current heads of the log
      const heads_ = await heads()
      // Create the next pointers from heads
      const nexts = heads_.map(entry => entry.hash)
      // Get references (pointers) to multiple entries in the past
      // (skips the heads which are covered by the next field)
      const refs = await getReferences(heads_, options.referencesCount + heads_.length)

      // Create the entry
      const entry = await Entry.create(
        identity,
        id,
        data,
        encryptPayloadFn,
        tickClock(await clock()),
        nexts,
        refs
      )

      // Authorize the entry
      const canAppend = await access.canAppend(entry)
      if (!canAppend) {
        throw new Error(`Could not append entry:\nKey "${identity.hash}" is not allowed to write to the log`)
      }

      // Add the entry to the oplog store (=store and index it)
      const hash = await oplogStore.setHead(entry)

      // Return the appended entry
      return { ...entry, hash }
    }

    return appendQueue.add(task)
  }
Append an new entry to the log

@param {data} data Payload to add to the entry
@param {Object} options
@param {number} options.referencesCount TODO
@return {module:Log~Entry} Entry that was appended
@memberof module:Log~Log
@instance