func()

in persistence/queue.go [100:121]


func (vq *valueQueue) Enqueue(obj interface{}) error {
	var queue []json.RawMessage
	var err error
	var bytes []byte
	// First marshal the given object into json text.
	if bytes, err = json.Marshal(obj); err != nil {
		return err
	}
	// Grab the value's associated persistence lock
	vq.value.mutex().Lock()
	defer vq.value.mutex().Unlock()
	// Load the existing queue in preparation for updating
	if err = vq.value.load(&queue); err != nil && err != ErrNotFound {
		return err
	}
	// Append the new value to the end of the queue, and store the result.
	queue = append(queue, bytes)
	if err := vq.value.store(queue); err != nil {
		return err
	}
	return nil
}