Codota Logo
Batch.createLocal
Code IndexAdd Codota to your IDE (free)

How to use
createLocal
method
in
org.apache.cassandra.batchlog.Batch

Best Java code snippets using org.apache.cassandra.batchlog.Batch.createLocal (Showing top 12 results out of 315)

  • Common ways to obtain Batch
private void myMethod () {
Batch b =
  • Codota IconUUID id;Collection mutations;Batch.createLocal(id, FBUtilities.timestampMicros(), mutations)
  • Codota IconUUID id;Collection encodedMutations;new Batch(id, creationTime, Collections.<Mutation>emptyList(), encodedMutations)
  • Codota IconUUID id;Collection decodedMutations;new Batch(id, creationTime, decodedMutations, Collections.emptyList())
  • Smart code suggestions by Codota
}
origin: org.apache.cassandra/cassandra-all

private static void syncWriteToBatchlog(Collection<Mutation> mutations, BatchlogEndpoints endpoints, UUID uuid, long queryStartNanoTime)
throws WriteTimeoutException, WriteFailureException
{
  WriteResponseHandler<?> handler = new WriteResponseHandler<>(endpoints.all,
                                 Collections.<InetAddress>emptyList(),
                                 endpoints.all.size() == 1 ? ConsistencyLevel.ONE : ConsistencyLevel.TWO,
                                 Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME),
                                 null,
                                 WriteType.BATCH_LOG,
                                 queryStartNanoTime);
  Batch batch = Batch.createLocal(uuid, FBUtilities.timestampMicros(), mutations);
  if (!endpoints.current.isEmpty())
    syncWriteToBatchlog(handler, batch, endpoints.current);
  if (!endpoints.legacy.isEmpty())
    LegacyBatchlogMigrator.syncWriteToBatchlog(handler, batch, endpoints.legacy);
  handler.get();
}
origin: jsevellec/cassandra-unit

private static void syncWriteToBatchlog(Collection<Mutation> mutations, BatchlogEndpoints endpoints, UUID uuid, long queryStartNanoTime)
throws WriteTimeoutException, WriteFailureException
{
  WriteResponseHandler<?> handler = new WriteResponseHandler<>(endpoints.all,
                                 Collections.<InetAddress>emptyList(),
                                 endpoints.all.size() == 1 ? ConsistencyLevel.ONE : ConsistencyLevel.TWO,
                                 Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME),
                                 null,
                                 WriteType.BATCH_LOG,
                                 queryStartNanoTime);
  Batch batch = Batch.createLocal(uuid, FBUtilities.timestampMicros(), mutations);
  if (!endpoints.current.isEmpty())
    syncWriteToBatchlog(handler, batch, endpoints.current);
  if (!endpoints.legacy.isEmpty())
    LegacyBatchlogMigrator.syncWriteToBatchlog(handler, batch, endpoints.legacy);
  handler.get();
}
origin: com.strapdata.cassandra/cassandra-all

private static void syncWriteToBatchlog(Collection<Mutation> mutations, BatchlogEndpoints endpoints, UUID uuid, long queryStartNanoTime)
throws WriteTimeoutException, WriteFailureException
{
  WriteResponseHandler<?> handler = new WriteResponseHandler<>(endpoints.all,
                                 Collections.<InetAddress>emptyList(),
                                 endpoints.all.size() == 1 ? ConsistencyLevel.ONE : ConsistencyLevel.TWO,
                                 Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME),
                                 null,
                                 WriteType.BATCH_LOG,
                                 queryStartNanoTime);
  Batch batch = Batch.createLocal(uuid, FBUtilities.timestampMicros(), mutations);
  if (!endpoints.current.isEmpty())
    syncWriteToBatchlog(handler, batch, endpoints.current);
  if (!endpoints.legacy.isEmpty())
    LegacyBatchlogMigrator.syncWriteToBatchlog(handler, batch, endpoints.legacy);
  handler.get();
}
origin: org.apache.cassandra/cassandra-all

public Batch deserialize(DataInputPlus in, int version) throws IOException
{
  UUID id = UUIDSerializer.serializer.deserialize(in, version);
  long creationTime = in.readLong();
  /*
   * If version doesn't match the current one, we cannot not just read the encoded mutations verbatim,
   * so we decode them instead, to deal with compatibility.
   */
  return version == MessagingService.current_version
     ? createRemote(id, creationTime, readEncodedMutations(in))
     : createLocal(id, creationTime, decodeMutations(in, version));
}
origin: com.strapdata.cassandra/cassandra-all

public Batch deserialize(DataInputPlus in, int version) throws IOException
{
  UUID id = UUIDSerializer.serializer.deserialize(in, version);
  long creationTime = in.readLong();
  /*
   * If version doesn't match the current one, we cannot not just read the encoded mutations verbatim,
   * so we decode them instead, to deal with compatibility.
   */
  return version == MessagingService.current_version
     ? createRemote(id, creationTime, readEncodedMutations(in))
     : createLocal(id, creationTime, decodeMutations(in, version));
}
origin: jsevellec/cassandra-unit

public Batch deserialize(DataInputPlus in, int version) throws IOException
{
  UUID id = UUIDSerializer.serializer.deserialize(in, version);
  long creationTime = in.readLong();
  /*
   * If version doesn't match the current one, we cannot not just read the encoded mutations verbatim,
   * so we decode them instead, to deal with compatibility.
   */
  return version == MessagingService.current_version
     ? createRemote(id, creationTime, readEncodedMutations(in))
     : createLocal(id, creationTime, decodeMutations(in, version));
}
origin: jsevellec/cassandra-unit

private static boolean apply(UntypedResultSet.Row row, long counter)
{
  UUID id = row.getUUID("id");
  long timestamp = id.version() == 1 ? UUIDGen.unixTimestamp(id) : row.getLong("written_at");
  int version = row.has("version") ? row.getInt("version") : MessagingService.VERSION_12;
  if (id.version() != 1)
    id = UUIDGen.getTimeUUID(timestamp, counter);
  logger.trace("Converting mutation at {}", timestamp);
  try (DataInputBuffer in = new DataInputBuffer(row.getBytes("data"), false))
  {
    int numMutations = in.readInt();
    List<Mutation> mutations = new ArrayList<>(numMutations);
    for (int i = 0; i < numMutations; i++)
      mutations.add(Mutation.serializer.deserialize(in, version));
    BatchlogManager.store(Batch.createLocal(id, TimeUnit.MILLISECONDS.toMicros(timestamp), mutations));
    return true;
  }
  catch (Throwable t)
  {
    logger.error("Failed to convert mutation {} at timestamp {}", id, timestamp, t);
    return false;
  }
}
origin: com.strapdata.cassandra/cassandra-all

private static boolean apply(UntypedResultSet.Row row, long counter)
{
  UUID id = row.getUUID("id");
  long timestamp = id.version() == 1 ? UUIDGen.unixTimestamp(id) : row.getLong("written_at");
  int version = row.has("version") ? row.getInt("version") : MessagingService.VERSION_12;
  if (id.version() != 1)
    id = UUIDGen.getTimeUUID(timestamp, counter);
  logger.trace("Converting mutation at {}", timestamp);
  try (DataInputBuffer in = new DataInputBuffer(row.getBytes("data"), false))
  {
    int numMutations = in.readInt();
    List<Mutation> mutations = new ArrayList<>(numMutations);
    for (int i = 0; i < numMutations; i++)
      mutations.add(Mutation.serializer.deserialize(in, version));
    BatchlogManager.store(Batch.createLocal(id, TimeUnit.MILLISECONDS.toMicros(timestamp), mutations));
    return true;
  }
  catch (Throwable t)
  {
    logger.error("Failed to convert mutation {} at timestamp {}", id, timestamp, t);
    return false;
  }
}
origin: org.apache.cassandra/cassandra-all

private static boolean apply(UntypedResultSet.Row row, long counter)
{
  UUID id = row.getUUID("id");
  long timestamp = id.version() == 1 ? UUIDGen.unixTimestamp(id) : row.getLong("written_at");
  int version = row.has("version") ? row.getInt("version") : MessagingService.VERSION_12;
  if (id.version() != 1)
    id = UUIDGen.getTimeUUID(timestamp, counter);
  logger.trace("Converting mutation at {}", timestamp);
  try (DataInputBuffer in = new DataInputBuffer(row.getBytes("data"), false))
  {
    int numMutations = in.readInt();
    List<Mutation> mutations = new ArrayList<>(numMutations);
    for (int i = 0; i < numMutations; i++)
      mutations.add(Mutation.serializer.deserialize(in, version));
    BatchlogManager.store(Batch.createLocal(id, TimeUnit.MILLISECONDS.toMicros(timestamp), mutations));
    return true;
  }
  catch (Throwable t)
  {
    logger.error("Failed to convert mutation {} at timestamp {}", id, timestamp, t);
    return false;
  }
}
origin: com.strapdata.cassandra/cassandra-all

BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(),
                    mutations), writeCommitLog);
  BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(), nonLocalMutations), writeCommitLog);
origin: org.apache.cassandra/cassandra-all

BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(),
                    mutations), writeCommitLog);
  BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(), nonLocalMutations), writeCommitLog);
origin: jsevellec/cassandra-unit

BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(),
                    mutations), writeCommitLog);
  BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(), nonLocalMutations), writeCommitLog);
org.apache.cassandra.batchlogBatchcreateLocal

Javadoc

Creates a 'local' batch - with all enclosed mutations in decoded form (as Mutation instances)

Popular methods of Batch

  • <init>
  • createRemote
    Creates a 'remote' batch - with all enclosed mutations in encoded form (as ByteBuffer instances) The
  • size
    Count of the mutations in the batch.

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • String (java.lang)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now