Takes a snapshot of the entity as it existed after the most recent
        event, optionally less than, or less than or equal to, a particular position.
18568
def take_snapshot(self, entity_id, lt=None, lte=None):
        
        snapshot = None
        if self._snapshot_strategy:
            # Get the latest event (optionally until a particular position).
            latest_event = self.event_store.get_most_recent_event(entity_id, lt=lt, lte=lte)

            # If there is something to snapshot, then look for a snapshot
            # taken before or at the entity version of the latest event. Please
            # note, the snapshot might have a smaller version number than
            # the latest event if events occurred since the latest snapshot was taken.
            if latest_event is not None:
                latest_snapshot = self._snapshot_strategy.get_snapshot(
                    entity_id, lt=lt, lte=lte
                )
                latest_version = latest_event.originator_version

                if latest_snapshot and latest_snapshot.originator_version == latest_version:
                    # If up-to-date snapshot exists, there's nothing to do.
                    snapshot = latest_snapshot
                else:
                    # Otherwise recover entity state from latest snapshot.
                    if latest_snapshot:
                        initial_state = entity_from_snapshot(latest_snapshot)
                        gt = latest_snapshot.originator_version
                    else:
                        initial_state = None
                        gt = None

                    # Fast-forward entity state to latest version.
                    entity = self.get_and_project_events(
                        entity_id=entity_id,
                        gt=gt,
                        lte=latest_version,
                        initial_state=initial_state,
                    )

                    # Take snapshot from entity.
                    snapshot = self._snapshot_strategy.take_snapshot(entity_id, entity, latest_version)

        return snapshot
167707
public synchronized void storeEventForCurrentAppVersion(double timestamp, int versionCode, String versionName, String eventLabel) {
		EventRecord eventRecord = events.get(eventLabel);
		if (eventRecord == null) {
			eventRecord = new EventRecord();
			events.put(eventLabel, eventRecord);
		}
		eventRecord.update(timestamp, versionName, versionCode);
		notifyDataChanged();
	}
17063
public int lastIndexOf(E object, int to) {
        Object[] snapshot = elements;
        return lastIndexOf(object, snapshot, 0, to);
    }
913082
function snapShot() {
    var doSnapShot = {};

    if (_screenAdjusted) {
      doSnapShot = _do.getScreenAdjustedEuler();
    } else {
      doSnapShot = _do.getFixedFrameEuler();
    }

    var accSnapShot = _dm.getScreenAdjustedAcceleration();
    var accGraSnapShot = _dm.getScreenAdjustedAccelerationIncludingGravity();
    var rotRateSnapShot = _dm.getScreenAdjustedRotationRate();

    var alphaToSend = 0;

    if (_orientationBase === GAME) {
      alphaToSend = doSnapShot.alpha - _calibrationValue;
      alphaToSend = (alphaToSend < 0) ? (360 - Math.abs(alphaToSend)) : alphaToSend;
    } else {
      alphaToSend = doSnapShot.alpha;
    }

    var snapShot = {
      do: {
        alpha: rnd(alphaToSend),
        beta: rnd(doSnapShot.beta),
        gamma: rnd(doSnapShot.gamma),
        absolute: _do.isAbsolute()
      },
      dm: {
        x: rnd(accSnapShot.x),
        y: rnd(accSnapShot.y),
        z: rnd(accSnapShot.z),
        gx: rnd(accGraSnapShot.x),
        gy: rnd(accGraSnapShot.y),
        gz: rnd(accGraSnapShot.z),
        alpha: rnd(rotRateSnapShot.alpha),
        beta: rnd(rotRateSnapShot.beta),
        gamma: rnd(rotRateSnapShot.gamma)
      }
    };

    // Normalize gravity
    if (_gravityNormalized) {
      snapShot.dm.gx *= _gravityCoefficient;
      snapShot.dm.gy *= _gravityCoefficient;
      snapShot.dm.gz *= _gravityCoefficient;
    }

    return snapShot;
  }
682283
def update_image_location(self, timeline_json):
        """"""
        if not timeline_json:
            return False

        # If we get a list of objects back (likely)
        # then we just want the first one as it should be the "newest"
        if isinstance(timeline_json, (tuple, list)):
            timeline_json = timeline_json[0]

        # Verify that the event code is of the "CAPTURE IMAGE" event
        event_code = timeline_json.get('event_code')
        if event_code != TIMELINE.CAPTURE_IMAGE['event_code']:
            raise AbodeException((ERROR.CAM_TIMELINE_EVENT_INVALID))

        # The timeline response has an entry for "file_path" that acts as the
        # location of the image within the Abode servers.
        file_path = timeline_json.get('file_path')
        if not file_path:
            raise AbodeException((ERROR.CAM_IMAGE_REFRESH_NO_FILE))

        # Perform a "head" request for the image and look for a
        # 302 Found response
        url = CONST.BASE_URL + file_path
        response = self._abode.send_request("head", url)

        if response.status_code != 302:
            _LOGGER.warning("Unexected response code %s with body: %s",
                            str(response.status_code), response.text)
            raise AbodeException((ERROR.CAM_IMAGE_UNEXPECTED_RESPONSE))

        # The response should have a location header that is the actual
        # location of the image stored on AWS
        location = response.headers.get('location')
        if not location:
            raise AbodeException((ERROR.CAM_IMAGE_NO_LOCATION_HEADER))

        self._image_url = location

        return True
1223930
@Override
	public void snapshotState(FunctionSnapshotContext context) throws Exception {
		Preconditions.checkState(this.checkpointedState != null,
			"The " + getClass().getSimpleName() + " has not been properly initialized.");

		this.checkpointedState.clear();
		this.checkpointedState.add(this.numElementsEmitted);
	}
1114102
def snapshot             (self):
		""""""
		nextSnapshotNum  = self.nextSnapshotNum
		nextSnapshotPath = self.getFullPathToSnapshot(nextSnapshotNum)
		
		if os.path.lexists(nextSnapshotPath):
			self.rmR(nextSnapshotPath)
		self.mkdirp(os.path.join(nextSnapshotPath, ".experiment"))
		return self.dump(nextSnapshotPath).__markLatest(nextSnapshotNum)
1357561
def snapshot_created(instance):
    
    last_snapshot = get_last_snapshot(instance)
    snapshot_created = get_created(last_snapshot)
    return api.to_date(snapshot_created)
1317528
@Override
  public void recordVariableUpdate(VariableInstanceEntity variable) {
    if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      HistoricVariableInstanceEntity historicProcessVariable = getEntityCache().findInCache(HistoricVariableInstanceEntity.class, variable.getId());
      if (historicProcessVariable == null) {
        historicProcessVariable = getHistoricVariableInstanceEntityManager().findHistoricVariableInstanceByVariableInstanceId(variable.getId());
      }

      if (historicProcessVariable != null) {
        getHistoricVariableInstanceEntityManager().copyVariableValue(historicProcessVariable, variable);
      } else {
        getHistoricVariableInstanceEntityManager().copyAndInsert(variable);
      }
    }
  }
637838
function Snapshot (id, obj) {
  if (!id) {
    var errIdMsg = 'id not injected!';
    debug(errIdMsg);
    throw new Error(errIdMsg);
  }

  if (!obj) {
    var errObjMsg = 'object not injected!';
    debug(errObjMsg);
    throw new Error(errObjMsg);
  }

  if (!obj.aggregateId) {
    var errAggIdMsg = 'object.aggregateId not injected!';
    debug(errAggIdMsg);
    throw new Error(errAggIdMsg);
  }

  if (!obj.data) {
    var errDataMsg = 'object.data not injected!';
    debug(errDataMsg);
    throw new Error(errDataMsg);
  }

  this.id = id;
  this.streamId = obj.aggregateId;
  this.aggregateId = obj.aggregateId;
  this.aggregate = obj.aggregate || null;
  this.context = obj.context || null;
  this.commitStamp = null;
  this.revision = obj.revision;
  this.version = obj.version;
  this.data = obj.data;
}
92112
def register_on_snapshot_changed(self, callback):
        
        event_type = library.VBoxEventType.on_snapshot_changed
        return self.event_source.register_callback(callback, event_type)
121389
private void takeSnapshotIfCommitIndexAdvanced() {
        long commitIndex = state.commitIndex();
        if ((commitIndex - state.log().snapshotIndex()) < commitIndexAdvanceCountToSnapshot) {
            return;
        }

        if (isTerminatedOrSteppedDown()) {
            // If the status is UPDATING_MEMBER_LIST or TERMINATING, it means the status is normally ACTIVE
            // and there is an appended but not committed RaftGroupCmd.
            // If the status is TERMINATED or STEPPED_DOWN, then there will not be any new appends.
            return;
        }

        RaftLog log = state.log();
        Object snapshot = raftIntegration.takeSnapshot(commitIndex);
        if (snapshot instanceof Throwable) {
            Throwable t = (Throwable) snapshot;
            logger.severe("Could not take snapshot at commit index: " + commitIndex, t);
            return;
        }

        int snapshotTerm = log.getLogEntry(commitIndex).term();
        RaftGroupMembers members = state.committedGroupMembers();
        SnapshotEntry snapshotEntry = new SnapshotEntry(snapshotTerm, commitIndex, snapshot, members.index(), members.members());

        long minMatchIndex = 0L;
        LeaderState leaderState = state.leaderState();
        if (leaderState != null) {
            long[] indices = leaderState.matchIndices();
            // Last slot is reserved for leader index,
            // and always zero. That's why we are skipping it.
            Arrays.sort(indices, 0, indices.length - 1);
            minMatchIndex = indices[0];
        }

        long truncateLogsUpToIndex = max(commitIndex - maxNumberOfLogsToKeepAfterSnapshot, minMatchIndex);
        int truncated = log.setSnapshot(snapshotEntry, truncateLogsUpToIndex);

        if (logger.isFineEnabled()) {
            logger.fine(snapshotEntry + " is taken, " + truncated + " entries are truncated.");
        }
    }
1059296
function (callback) {
            getData.takeSnapshot(page, ph, function (error, page, ph, dom) {
                if (error) {
                    callback (error);
                    return;
                }

                originalDom = dom;
                callback();
            });
        }
95023
def previous(self):
        
        return self.model.state.get_entity(
            self.entity_type, self.entity_id, self._history_index - 1,
            connected=False)
1211794
def OnBackView(self, event):
        """"""
        self.historyIndex -= 1
        try:
            self.RestoreHistory(self.history[self.historyIndex])
        except IndexError, err:
            self.SetStatusText(_('No further history available'))
321751
def snapshot(self):
        """"""
        self._snapshot = {
            'muted': self.muted,
            'volume': self.volume,
            'stream': self.stream
        }
        _LOGGER.info('took snapshot of current state of %s', self.friendly_name)
398251
function saveAfter(pos) {
        if (self.history.textAfter(pos.node).length > pos.offset) {
          self.line = pos.node;
          self.offset = pos.offset + 1;
        }
        else {
          self.line = self.history.nodeAfter(pos.node);
          self.offset = 0;
        }
      }