Creates a SNAPSHOT message.

@param lastZxid the last zxid of the sender.
@param snapZxid the last guaranteed applied zxid in snapshot.
@return a protobuf message.
965879
public static Message buildSnapshot(Zxid lastZxid, Zxid snapZxid) {
    ZabMessage.Zxid lZxid = toProtoZxid(lastZxid);
    ZabMessage.Zxid sZxid = toProtoZxid(snapZxid);
    Snapshot snapshot = Snapshot.newBuilder().setLastZxid(lZxid)
                                             .setSnapZxid(sZxid)
                                             .build();
    return Message.newBuilder().setType(MessageType.SNAPSHOT)
                               .setSnapshot(snapshot)
                               .build();
  }
717748
public void createAllDevNullTargets(Exception lastWriteException)
    {
        Map<Integer, SnapshotDataTarget> targets = Maps.newHashMap();
        final AtomicInteger numTargets = new AtomicInteger();

        for (Deque<SnapshotTableTask> tasksForSite : m_taskListsForHSIds.values()) {
            for (SnapshotTableTask task : tasksForSite) {
                // Close any created targets and replace them with DevNull, go web-scale
                if (task.getTarget(true) != null) {
                    try {
                        task.getTarget().close();
                    } catch (Exception e) {
                        SNAP_LOG.error("Failed closing data target after error", e);
                    }
                }

                SnapshotDataTarget target = targets.get(task.m_table.getRelativeIndex());
                if (target == null) {
                    target = new DevNullSnapshotTarget(lastWriteException);
                    final Runnable onClose = new TargetStatsClosure(target,
                            task.m_table.getTypeName(),
                            numTargets,
                            m_snapshotRecord);
                    target.setOnCloseHandler(onClose);

                    targets.put(task.m_table.getRelativeIndex(), target);
                    m_targets.add(target);
                    numTargets.incrementAndGet();
                }

                task.setTarget(target);
            }
        }
    }
279672
public MockVolume createVolume(
            final String volumeType, final String size, final String availabilityZone,
            final int iops,
            final String snapshotId) {

        MockVolume ret = new MockVolume();
        ret.setVolumeType(volumeType);
        ret.setVolumeId(
                "vol-" + UUID.randomUUID().toString().substring(0, VOLUME_ID_POSTFIX_LENGTH));
        ret.setSize(size);
        ret.setAvailabilityZone(availabilityZone);
        ret.setIops(iops);
        ret.setSnapshotId(snapshotId);

        allMockVolumes.put(ret.getVolumeId(), ret);
        return ret;
    }
285353
public Snapshot newTemporarySnapshot(long index, WallClockTimestamp timestamp) {
    SnapshotDescriptor descriptor = SnapshotDescriptor.builder()
        .withIndex(index)
        .withTimestamp(timestamp.unixTimestamp())
        .build();
    return newSnapshot(descriptor, StorageLevel.MEMORY);
  }
136744
private Snapshot newSnapshot(SnapshotDescriptor descriptor, StorageLevel storageLevel) {
    if (storageLevel == StorageLevel.MEMORY) {
      return createMemorySnapshot(descriptor);
    } else {
      return createDiskSnapshot(descriptor);
    }
  }
1319724
def create_snapshot(self, volume, name=None, description=None, force=False):
        
        return self._snapshot_manager.create(volume=volume, name=name,
                description=description, force=force)
603744
public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) {
        checkNotNull(request, "request should not be null.");
        checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty.");
        InternalRequest internalRequest =
                this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId());
        return invokeHttpClient(internalRequest, GetSnapshotResponse.class);
    }
279035
private Snapshot createDiskSnapshot(SnapshotDescriptor descriptor) {
    SnapshotFile file = new SnapshotFile(SnapshotFile.createSnapshotFile(name, storage.directory(), descriptor.index(), descriptor.timestamp()));
    Snapshot snapshot = new FileSnapshot(file, this);
    LOGGER.debug("Created disk snapshot: {}", snapshot);
    return snapshot;
  }
60647
public CompletableFuture<Void> snapshot() {
    return Futures.allOf(config.getMembers().stream()
        .map(MemberId::from)
        .map(id -> communicationService.send(snapshotSubject, null, id, SNAPSHOT_TIMEOUT))
        .collect(Collectors.toList()))
        .thenApply(v -> null);
  }
1222234
def create_snappy_message(message_set):
    
    encoded_message_set = KafkaCodec._encode_message_set(message_set)
    snapped = snappy_encode(encoded_message_set)
    return Message(0, CODEC_SNAPPY, None, snapped)
40477
@Override
	public PojoSerializerSnapshot<T> snapshotConfiguration() {
		return buildSnapshot(
				clazz,
				registeredClasses,
				registeredSerializers,
				fields,
				fieldSerializers,
				subclassSerializerCache);
	}
98407
public Xid createXid() {
        byte[] globalId = baseId.clone();
        long id;
        synchronized (this) {
            id = count++;
        }
        insertLong(id, globalId, 0);
        return new XidImpl(globalId);
    }
847469
protected String getSnapshotIdFromProperties(String spaceId) {
        Properties props = new Properties();
        try (InputStream is = this.snapshotProvider.getContent(spaceId, Constants.SNAPSHOT_PROPS_FILENAME)
                                                   .getContentStream()) {
            props.load(is);
            return props.getProperty(Constants.SNAPSHOT_ID_PROP);
        } catch (NotFoundException ex) {
            return null;
        } catch (Exception e) {
            throw new TaskException(
                MessageFormat.format("Call to create snapshot failed, unable to determine existence of " +
                                     "snapshot properties file in {0}. Error: {1}", spaceId, e.getMessage()));
        }
    }
180133
public static Message buildDiff(Zxid lastZxid) {
    ZabMessage.Zxid lz = toProtoZxid(lastZxid);

    Diff diff = Diff.newBuilder().setLastZxid(lz).build();

    return Message.newBuilder().setType(MessageType.DIFF)
                               .setDiff(diff)
                               .build();
  }
216197
function Snap (params) {
  var self = this
  if (!(self instanceof Snap)) return new Snap(params)

  // null until you call load
  self.blob = null

  // null if snap is outgoing
  self.sender = params['sn']

  // null if snap is incoming
  self.recipient = params['rp']

  self.identifier = params['id']
  self.conversationIdentifier = params['c_id']
  self.mediaKind = params['m'] | 0
  self.status = params['st'] | 0
  self.screenshots = params['c'] | 0
  // 0 if snap is outgoing
  self.timer = params['t'] | 0
  // actual length of the video or the same as timer for images. 0 if snap is outgoing
  self.mediaTimer = +params['rp']
  self.sentDate = new Date(+(params['sts'] || params['ts']))
  self.zipped = !!params['zipped']
}
1358003
public String serialize() {
        JaxbJsonSerializer<CreateSnapshotBridgeParameters> serializer =
            new JaxbJsonSerializer<>(CreateSnapshotBridgeParameters.class);
        try {
            return serializer.serialize(this);
        } catch (IOException e) {
            throw new SnapshotDataException(
                "Unable to create task result due to: " + e.getMessage());
        }
    }
369886
ClusterConfiguration getLastConfigWithin(Zxid zxid) throws IOException {
    String pattern = "cluster_config\\.\\d+_-?\\d+";
    String zxidFileName = "cluster_config." + zxid.toSimpleString();
    String lastFileName = null;

    for (File file : this.rootDir.listFiles()) {
      if (!file.isDirectory() && file.getName().matches(pattern)) {
        String fileName = file.getName();
        if (lastFileName == null && fileName.compareTo(zxidFileName) <= 0) {
          lastFileName = fileName;
        } else if (lastFileName != null &&
                   fileName.compareTo(lastFileName) > 0 &&
                   fileName.compareTo(zxidFileName) <= 0) {
          lastFileName = fileName;
        }
      }
    }
    if (lastFileName == null) {
      return null;
    }
    File file = new File(this.rootDir, lastFileName);
    try {
      Properties prop = FileUtils.readPropertiesFromFile(file);
      return ClusterConfiguration.fromProperties(prop);
    } catch (FileNotFoundException e) {
      LOG.debug("AckConfig file doesn't exist, probably it's the first time" +
          "bootup.");
    }
    return null;
  }