Package co.cask.tephra.persist

Examples of co.cask.tephra.persist.TransactionSnapshot


  }

  @Override
  public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
                                  InternalScanner scanner) throws IOException {
    TransactionSnapshot snapshot = cache.getLatestState();
    if (snapshot != null) {
      return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner, snapshot.getVisibilityUpperBound());
    }
    return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner);
  }
View Full Code Here


  }

  @Override
  public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
                                    InternalScanner scanner) throws IOException {
    TransactionSnapshot snapshot = cache.getLatestState();
    if (snapshot != null) {
      return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner, snapshot.getVisibilityUpperBound());
    }
    return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner);
  }
View Full Code Here

  @Override
  public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
                                    InternalScanner scanner, CompactionRequest request)
    throws IOException {
    TransactionSnapshot snapshot = cache.getLatestState();
    if (snapshot != null) {
      return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner, snapshot.getVisibilityUpperBound());
    }
    return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner);
  }
View Full Code Here

      Collection<Long> invalid = decodeInvalid(decoder);
      NavigableMap<Long, TransactionManager.InProgressTx> inProgress = decodeInProgress(decoder);
      NavigableMap<Long, Set<ChangeId>> committing = decodeChangeSets(decoder);
      NavigableMap<Long, Set<ChangeId>> committed = decodeChangeSets(decoder);

      return new TransactionSnapshot(timestamp, readPointer, writePointer, invalid, inProgress,
                                     committing, committed);
    } catch (IOException e) {
      LOG.error("Unable to deserialize transaction state: ", e);
      throw Throwables.propagate(e);
    }
View Full Code Here

      }
    }
  }

  private void executeViewMode() {
    TransactionSnapshot snapshot = null;
    if (hostname != null && portNumber != null) {
      // Take new snapshot and download it
      snapshot = takeSnapshot();
    } else if (existingFilename != null) {
      // Retrieve saved snapshot
View Full Code Here

    try {
      System.out.println("Retrieving snapshot from file " + existingFilename);
      File snapshotFile = new File(existingFilename);
      FileInputStream fis = new FileInputStream(snapshotFile);
      try {
        TransactionSnapshot snapshot = codecProvider.decode(fis);
        System.out.println("Snapshot retrieved, timestamp is " + snapshot.getTimestamp() + " ms.");
        return snapshot;
      } finally {
        fis.close();
      }
    } catch (IOException e) {
View Full Code Here

                         url.toURI() + ", timestamp is " + System.currentTimeMillis() + " ms");
      int responseCode = connection.getResponseCode();
      if (responseCode == 200) {
        // Retrieve and deserialize the snapshot
        InputStream input = connection.getInputStream();
        TransactionSnapshot snapshot;
        try {
          snapshot = codecProvider.decode(input);
        } finally {
          input.close();
        }
        System.out.println("Snapshot taken and retrieved properly, snapshot timestamp is " +
                           snapshot.getTimestamp() + " ms");

        if (persistingFilename != null) {
          // Persist the snapshot on disk for future queries and debugging
          File outputFile = new File(persistingFilename);
          OutputStream out = new FileOutputStream(outputFile);
View Full Code Here

  }

  @Override
  public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
                                  InternalScanner scanner) throws IOException {
    TransactionSnapshot snapshot = cache.getLatestState();
    if (snapshot != null) {
      return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner, snapshot.getVisibilityUpperBound());
    }
    return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner);
  }
View Full Code Here

  }

  @Override
  public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
                                    InternalScanner scanner, ScanType scanType) throws IOException {
    TransactionSnapshot snapshot = cache.getLatestState();
    if (snapshot != null) {
      return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner, snapshot.getVisibilityUpperBound());
    }
    return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner);
  }
View Full Code Here

  @Override
  public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
                                    InternalScanner scanner, ScanType scanType, CompactionRequest request)
    throws IOException {
    TransactionSnapshot snapshot = cache.getLatestState();
    if (snapshot != null) {
      return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner, snapshot.getVisibilityUpperBound());
    }
    return new IncrementSummingScanner(region, BATCH_UNLIMITED, scanner);
  }
View Full Code Here

TOP

Related Classes of co.cask.tephra.persist.TransactionSnapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.