1 /**
  2  * Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
  3  *
  4  * @licstart
  5  * This file is part of WebODF.
  6  *
  7  * WebODF is free software: you can redistribute it and/or modify it
  8  * under the terms of the GNU Affero General Public License (GNU AGPL)
  9  * as published by the Free Software Foundation, either version 3 of
 10  * the License, or (at your option) any later version.
 11  *
 12  * WebODF is distributed in the hope that it will be useful, but
 13  * WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15  * GNU Affero General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Affero General Public License
 18  * along with WebODF.  If not, see <http://www.gnu.org/licenses/>.
 19  * @licend
 20  *
 21  * @source: http://www.webodf.org/
 22  * @source: https://github.com/kogmbh/WebODF/
 23  */
 24 
 25 /*global ops*/
 26 /*jslint emptyblock: true, unparam: true*/
 27 
 28 /**
 29  * @interface
 30  */
 31 ops.OperationRouter = function OperationRouter() {"use strict"; };
 32 
 33 /**
 34  * Sets the factory to use to create operation instances from operation specs.
 35  *
 36  * @param {!ops.OperationFactory} f
 37  * @return {undefined}
 38  */
 39 ops.OperationRouter.prototype.setOperationFactory = function (f) {"use strict"; };
 40 
 41 /**
 42  * Sets the method which should be called to apply operations.
 43  *
 44  * @param {!function(!ops.Operation):boolean} playback_func
 45  * @return {undefined}
 46  */
 47 ops.OperationRouter.prototype.setPlaybackFunction = function (playback_func) {"use strict"; };
 48 
 49 /**
 50  * Brings the locally created operations into the game.
 51  * The ops are guaranteed to be executed directly after each other, in the given order
 52  * (first will be executed first).
 53  * TODO: currently all known implementations only use the specs of the operations,
 54  * so it might make sense to not create any operations outside of the operation router at all
 55  * and instead just create specs and pass them to this push method?
 56  *
 57  * @param {!Array.<!ops.Operation>} operations
 58  * @return {undefined}
 59  */
 60 ops.OperationRouter.prototype.push = function (operations) {"use strict"; };
 61 
 62 /**
 63  * Requests a gracefull shutdown of the Operation Router.
 64  * Buffered operations shall be sent to the master session (if any).
 65  * A callback is called, getting passed an error object in case of error.
 66  *
 67  * @param {!function(!Object=)} callback
 68  * @return {undefined}
 69  */
 70 ops.OperationRouter.prototype.close = function (callback) {"use strict"; };
 71 
 72 /**
 73  * The passed cb will be called on every event of type eventId.
 74  *
 75  * @param {!string} eventId
 76  * @param {!Function} cb
 77  * @return {undefined}
 78  */
 79 ops.OperationRouter.prototype.subscribe = function (eventId, cb) {"use strict"; };
 80 
 81 /**
 82  * Undoes the subscription done with subscribe(...).
 83  *
 84  * @param {!string} eventId
 85  * @param {!Function} cb
 86  * @return {undefined}
 87  */
 88 ops.OperationRouter.prototype.unsubscribe = function (eventId, cb) {"use strict"; };
 89 
 90 /**
 91  * Returns if there are operations done locally that have not yet been
 92  * synchronized with the host of the session.
 93  *
 94  * @return {!boolean}
 95  */
 96 ops.OperationRouter.prototype.hasLocalUnsyncedOps = function () {"use strict"; };
 97 
 98 /**
 99  * Returns if the connection to the host of the session is currently existing.
100  *
101  * @return {!boolean}
102  */
103 ops.OperationRouter.prototype.hasSessionHostConnection = function () {"use strict"; };
104 
105 /**
106  * Signal that the operation router is about to process a batch of operations.
107  * @const
108  * @type {string}
109  */
110 ops.OperationRouter.signalProcessingBatchStart = "router/batchstart";
111 
112 /**
113  * Signal that the operation router has just completed processing a batch of operations.
114  * @const
115  * @type {string}
116  */
117 ops.OperationRouter.signalProcessingBatchEnd = "router/batchend";
118