Tabnine Logo
RollingStorage.asReadableHandle
Code IndexAdd Tabnine to your IDE (free)

How to use
asReadableHandle
method
in
io.pravega.segmentstore.storage.rolling.RollingStorage

Best Java code snippets using io.pravega.segmentstore.storage.rolling.RollingStorage.asReadableHandle (Showing top 4 results out of 315)

origin: pravega/pravega

private RollingSegmentHandle asWritableHandle(SegmentHandle handle) {
  Preconditions.checkArgument(!handle.isReadOnly(), "handle must not be read-only.");
  return asReadableHandle(handle);
}
origin: pravega/pravega

@Override
public int read(SegmentHandle handle, long offset, byte[] buffer, int bufferOffset, int length) throws StreamSegmentException {
  val h = asReadableHandle(handle);
  long traceId = LoggerHelpers.traceEnter(log, "read", handle, offset, length);
  ensureNotDeleted(h);
origin: pravega/pravega

@Override
public void truncate(SegmentHandle handle, long truncationOffset) throws StreamSegmentException {
  // Delete all SegmentChunks which are entirely before the truncation offset.
  RollingSegmentHandle h = asReadableHandle(handle);
  ensureNotDeleted(h);
  // The only acceptable case where we allow a read-only handle is if the Segment is sealed, since openWrite() will
  // only return a read-only handle in that case.
  Preconditions.checkArgument(h.isSealed() || !h.isReadOnly(), "Can only truncate with a read-only handle if the Segment is Sealed.");
  if (h.getHeaderHandle() == null) {
    // No header means the Segment is made up of a single SegmentChunk. We can't do anything.
    return;
  }
  long traceId = LoggerHelpers.traceEnter(log, "truncate", h, truncationOffset);
  Preconditions.checkArgument(truncationOffset >= 0 && truncationOffset <= h.length(),
      "truncationOffset must be non-negative and at most the length of the Segment.");
  val last = h.lastChunk();
  if (last != null && canTruncate(last, truncationOffset) && !h.isSealed()) {
    // If we were asked to truncate the entire (non-sealed) Segment, then rollover at this point so we can delete
    // all existing data.
    rollover(h);
    // We are free to delete all chunks.
    deleteChunks(h, s -> canTruncate(s, truncationOffset));
  } else {
    // Either we were asked not to truncate the whole segment, or we were, and the Segment is sealed. If the latter,
    // then the Header is also sealed, we could not have done a quick rollover; as such we have no option but to
    // preserve the last chunk so that we can recalculate the length of the Segment if we need it again.
    deleteChunks(h, s -> canTruncate(s, truncationOffset) && s.getLastOffset() < h.length());
  }
  LoggerHelpers.traceLeave(log, "truncate", traceId, h, truncationOffset);
}
origin: pravega/pravega

@Override
public void delete(SegmentHandle handle) throws StreamSegmentException {
  val h = asReadableHandle(handle);
  long traceId = LoggerHelpers.traceEnter(log, "delete", handle);
io.pravega.segmentstore.storage.rollingRollingStorageasReadableHandle

Popular methods of RollingStorage

  • <init>
    Creates a new instance of the RollingStorage class.
  • create
  • delete
  • openRead
  • openWrite
  • seal
  • asWritableHandle
  • canTruncate
  • checkIfEmptyAndNotSealed
  • checkTruncatedSegment
  • concat
  • createChunk
  • concat,
  • createChunk,
  • createHeader,
  • deleteChunks,
  • ensureNotDeleted,
  • ensureNotSealed,
  • ensureOffset,
  • exists,
  • getHeaderInfo

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • findViewById (Activity)
  • getSharedPreferences (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • JButton (javax.swing)
  • JPanel (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now