/usr/share/z-push/lib/interface/istatemachine.php is in z-push-common 2.3.8-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <?php
/***********************************************
* File : istatemachine.php
* Project : Z-Push
* Descr : Interface called from the Device and
* StateManager to save states for a user/device/folder.
* Z-Push implements the FileStateMachine which
* saves states to disk.
* Backends provide their own IStateMachine
* implementation of this interface and return
* an IStateMachine instance with IBackend->GetStateMachine().
* Old sync states are not deleted until a new sync state
* is requested.
* At that moment, the PIM is apparently requesting an update
* since sync key X, so any sync states before X are already on
* the PIM, and can therefore be removed. This algorithm should be
* automatically enforced by the IStateMachine implementation.
*
* Created : 02.01.2012
*
* Copyright 2007 - 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
************************************************/
interface IStateMachine {
const DEFTYPE = "";
const DEVICEDATA = "devicedata";
const FOLDERDATA = "fd";
const FAILSAVE = "fs";
const HIERARCHY = "hc";
const BACKENDSTORAGE = "bs";
const STATEVERSION_01 = "1"; // Z-Push 2.0.x - default value if unset
const STATEVERSION_02 = "2"; // Z-Push 2.1.0 Milestone 1
/**
* Constructor
* @throws FatalMisconfigurationException
*/
/**
* Gets a hash value indicating the latest dataset of the named
* state with a specified key and counter.
* If the state is changed between two calls of this method
* the returned hash should be different
*
* @param string $devid the device id
* @param string $type the state type
* @param string $key (opt)
* @param string $counter (opt)
*
* @access public
* @return string
* @throws StateNotFoundException, StateInvalidException, UnavailableException
*/
public function GetStateHash($devid, $type, $key = false, $counter = false);
/**
* Gets a state for a specified key and counter.
* This method sould call IStateMachine->CleanStates()
* to remove older states (same key, previous counters)
*
* @param string $devid the device id
* @param string $type the state type
* @param string $key (opt)
* @param string $counter (opt)
* @param string $cleanstates (opt)
*
* @access public
* @return mixed
* @throws StateNotFoundException, StateInvalidException, UnavailableException
*/
public function GetState($devid, $type, $key = false, $counter = false, $cleanstates = true);
/**
* Writes ta state to for a key and counter
*
* @param mixed $state
* @param string $devid the device id
* @param string $type the state type
* @param string $key (opt)
* @param int $counter (opt)
*
* @access public
* @return boolean
* @throws StateInvalidException, UnavailableException
*/
public function SetState($state, $devid, $type, $key = false, $counter = false);
/**
* Cleans up all older states.
* If called with a $counter, all states previous state counter can be removed.
* If additionally the $thisCounterOnly flag is true, only that specific counter will be removed.
* If called without $counter, all keys (independently from the counter) can be removed.
*
* @param string $devid the device id
* @param string $type the state type
* @param string $key
* @param string $counter (opt)
* @param string $thisCounterOnly (opt) if provided, the exact counter only will be removed
*
* @access public
* @return
* @throws StateInvalidException
*/
public function CleanStates($devid, $type, $key, $counter = false, $thisCounterOnly = false);
/**
* Links a user to a device
*
* @param string $username
* @param string $devid
*
* @access public
* @return boolean indicating if the user was added or not (existed already)
*/
public function LinkUserDevice($username, $devid);
/**
* Unlinks a device from a user
*
* @param string $username
* @param string $devid
*
* @access public
* @return boolean
*/
public function UnLinkUserDevice($username, $devid);
/**
* Returns an array with all device ids for a user.
* If no user is set, all device ids should be returned
*
* @param string $username (opt)
*
* @access public
* @return array
*/
public function GetAllDevices($username = false);
/**
* Returns the current version of the state files
*
* @access public
* @return int
*/
public function GetStateVersion();
/**
* Sets the current version of the state files
*
* @param int $version the new supported version
*
* @access public
* @return boolean
*/
public function SetStateVersion($version);
/**
* Returns all available states for a device id
*
* @param string $devid the device id
*
* @access public
* @return array(mixed)
*/
public function GetAllStatesForDevice($devid);
}
|