(backend, agent, index, id, op, options)
| 7 | var ERROR_CODE = ShareDBError.CODES; |
| 8 | |
| 9 | function SubmitRequest(backend, agent, index, id, op, options) { |
| 10 | this.backend = backend; |
| 11 | this.agent = agent; |
| 12 | // If a projection, rewrite the call into a call against the collection |
| 13 | var projection = backend.projections[index]; |
| 14 | this.index = index; |
| 15 | this.projection = projection; |
| 16 | this.collection = (projection) ? projection.target : index; |
| 17 | this.id = id; |
| 18 | this.op = op; |
| 19 | this.options = options; |
| 20 | |
| 21 | this.extra = op.x; |
| 22 | delete op.x; |
| 23 | |
| 24 | this.start = Date.now(); |
| 25 | this._addOpMeta(); |
| 26 | |
| 27 | // Set as this request is sent through middleware |
| 28 | this.action = null; |
| 29 | // For custom use in middleware |
| 30 | this.custom = Object.create(null); |
| 31 | |
| 32 | // Whether or not to store a milestone snapshot. If left as null, the milestone |
| 33 | // snapshots are saved according to the interval provided to the milestone db |
| 34 | // options. If overridden to a boolean value, then that value is used instead of |
| 35 | // the interval logic. |
| 36 | this.saveMilestoneSnapshot = null; |
| 37 | this.suppressPublish = backend.suppressPublish; |
| 38 | this.maxRetries = backend.maxSubmitRetries; |
| 39 | this.retries = 0; |
| 40 | |
| 41 | // return values |
| 42 | this.snapshot = null; |
| 43 | this.ops = []; |
| 44 | this.channels = null; |
| 45 | this._fixupOps = []; |
| 46 | } |
| 47 | module.exports = SubmitRequest; |
| 48 | |
| 49 | SubmitRequest.prototype.$fixup = function(op) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…