id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
132,300 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java | DataFrame.startNewEntry | boolean startNewEntry(boolean firstRecordEntry) {
Preconditions.checkState(!this.sealed, "DataFrame is sealed and cannot accept any more entries.");
endEntry(true);
if (getAvailableLength() < MIN_ENTRY_LENGTH_NEEDED) {
// If we cannot fit at least entry header + 1 byte, we cannot re... | java | boolean startNewEntry(boolean firstRecordEntry) {
Preconditions.checkState(!this.sealed, "DataFrame is sealed and cannot accept any more entries.");
endEntry(true);
if (getAvailableLength() < MIN_ENTRY_LENGTH_NEEDED) {
// If we cannot fit at least entry header + 1 byte, we cannot re... | [
"boolean",
"startNewEntry",
"(",
"boolean",
"firstRecordEntry",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"this",
".",
"sealed",
",",
"\"DataFrame is sealed and cannot accept any more entries.\"",
")",
";",
"endEntry",
"(",
"true",
")",
";",
"if",
"(",... | Indicates that a new DataFrame Entry should be opened.
@param firstRecordEntry If true, this entry will be marked as the first entry in a record (records can be split
across multiple frames, and this helps ensure that, upon reading, the records are recomposed
starting with the right Data Frame Entry).
@return True if ... | [
"Indicates",
"that",
"a",
"new",
"DataFrame",
"Entry",
"should",
"be",
"opened",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java#L152-L166 |
132,301 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java | DataFrame.endEntry | boolean endEntry(boolean endOfRecord) {
// Check to see if we actually have an entry started.
if (this.writeEntryStartIndex >= 0) {
int entryLength = this.writePosition - this.writeEntryStartIndex - WriteEntryHeader.HEADER_SIZE;
assert entryLength >= 0 : "entryLength is negative.... | java | boolean endEntry(boolean endOfRecord) {
// Check to see if we actually have an entry started.
if (this.writeEntryStartIndex >= 0) {
int entryLength = this.writePosition - this.writeEntryStartIndex - WriteEntryHeader.HEADER_SIZE;
assert entryLength >= 0 : "entryLength is negative.... | [
"boolean",
"endEntry",
"(",
"boolean",
"endOfRecord",
")",
"{",
"// Check to see if we actually have an entry started.",
"if",
"(",
"this",
".",
"writeEntryStartIndex",
">=",
"0",
")",
"{",
"int",
"entryLength",
"=",
"this",
".",
"writePosition",
"-",
"this",
".",
... | Indicates that the currently open DataFrame Entry can be ended.
@param endOfRecord If true, this entry will be marked as the last entry in a record (records can be split across
multiple frames, and this helps ensure that, upon read, the records are recomposed ending with
the right DataFrame Entry).
@return True if we ... | [
"Indicates",
"that",
"the",
"currently",
"open",
"DataFrame",
"Entry",
"can",
"be",
"ended",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java#L191-L206 |
132,302 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java | DataFrame.append | int append(ByteArraySegment data) {
ensureAppendConditions();
int actualLength = Math.min(data.getLength(), getAvailableLength());
if (actualLength > 0) {
this.contents.copyFrom(data, writePosition, actualLength);
writePosition += actualLength;
}
return ... | java | int append(ByteArraySegment data) {
ensureAppendConditions();
int actualLength = Math.min(data.getLength(), getAvailableLength());
if (actualLength > 0) {
this.contents.copyFrom(data, writePosition, actualLength);
writePosition += actualLength;
}
return ... | [
"int",
"append",
"(",
"ByteArraySegment",
"data",
")",
"{",
"ensureAppendConditions",
"(",
")",
";",
"int",
"actualLength",
"=",
"Math",
".",
"min",
"(",
"data",
".",
"getLength",
"(",
")",
",",
"getAvailableLength",
"(",
")",
")",
";",
"if",
"(",
"actua... | Appends the contents of the ByteArraySegment to the DataFrame.
@param data The ByteArraySegment to append.
@return The number of bytes written. If less than the length of the ByteArraySegment, the frame is full and cannot
write anything anymore. The remaining bytes will need to be written to a new frame.
@throws Illeg... | [
"Appends",
"the",
"contents",
"of",
"the",
"ByteArraySegment",
"to",
"the",
"DataFrame",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java#L235-L245 |
132,303 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java | DataFrame.seal | void seal() {
if (!this.sealed && !this.contents.isReadOnly()) {
Preconditions.checkState(writeEntryStartIndex < 0, "An open entry exists. Any open entries must be closed prior to sealing.");
this.header.setContentLength(writePosition);
this.header.commit();
this... | java | void seal() {
if (!this.sealed && !this.contents.isReadOnly()) {
Preconditions.checkState(writeEntryStartIndex < 0, "An open entry exists. Any open entries must be closed prior to sealing.");
this.header.setContentLength(writePosition);
this.header.commit();
this... | [
"void",
"seal",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"sealed",
"&&",
"!",
"this",
".",
"contents",
".",
"isReadOnly",
"(",
")",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"writeEntryStartIndex",
"<",
"0",
",",
"\"An open entry exists. Any op... | Seals the frame for writing. After this method returns, no more modifications are allowed on this DataFrame.
This method has no effect if the Frame is read-only if it is already sealed.
@throws IllegalStateException If an open entry exists (entries must be closed prior to sealing). | [
"Seals",
"the",
"frame",
"for",
"writing",
".",
"After",
"this",
"method",
"returns",
"no",
"more",
"modifications",
"are",
"allowed",
"on",
"this",
"DataFrame",
".",
"This",
"method",
"has",
"no",
"effect",
"if",
"the",
"Frame",
"is",
"read",
"-",
"only",... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java#L253-L261 |
132,304 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java | DataFrame.read | public static DataFrameEntryIterator read(InputStream source, int length, LogAddress address) throws IOException {
// Check to see that we have enough bytes in the InputStream.
ReadFrameHeader header = new ReadFrameHeader(source);
if (length < ReadFrameHeader.SERIALIZATION_LENGTH + header.getCon... | java | public static DataFrameEntryIterator read(InputStream source, int length, LogAddress address) throws IOException {
// Check to see that we have enough bytes in the InputStream.
ReadFrameHeader header = new ReadFrameHeader(source);
if (length < ReadFrameHeader.SERIALIZATION_LENGTH + header.getCon... | [
"public",
"static",
"DataFrameEntryIterator",
"read",
"(",
"InputStream",
"source",
",",
"int",
"length",
",",
"LogAddress",
"address",
")",
"throws",
"IOException",
"{",
"// Check to see that we have enough bytes in the InputStream.",
"ReadFrameHeader",
"header",
"=",
"new... | Interprets the given InputStream as a DataFrame and returns a DataFrameEntryIterator for the entries serialized
in it.
@param source The InputStream to read from.
@param length The size of the inputStream.
@param address The DataFrame's address.
@return A new DataFrameEntryIterator.
@throws IOException If unable to ... | [
"Interprets",
"the",
"given",
"InputStream",
"as",
"a",
"DataFrame",
"and",
"returns",
"a",
"DataFrameEntryIterator",
"for",
"the",
"entries",
"serialized",
"in",
"it",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrame.java#L289-L299 |
132,305 | pravega/pravega | client/src/main/java/io/pravega/client/netty/impl/Flow.java | Flow.create | public static Flow create() {
return new Flow(ID_GENERATOR.updateAndGet(i -> i == Integer.MAX_VALUE ? 0 : i + 1), 0);
} | java | public static Flow create() {
return new Flow(ID_GENERATOR.updateAndGet(i -> i == Integer.MAX_VALUE ? 0 : i + 1), 0);
} | [
"public",
"static",
"Flow",
"create",
"(",
")",
"{",
"return",
"new",
"Flow",
"(",
"ID_GENERATOR",
".",
"updateAndGet",
"(",
"i",
"->",
"i",
"==",
"Integer",
".",
"MAX_VALUE",
"?",
"0",
":",
"i",
"+",
"1",
")",
",",
"0",
")",
";",
"}"
] | Create a new Flow.
@return Flow. | [
"Create",
"a",
"new",
"Flow",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/netty/impl/Flow.java#L48-L50 |
132,306 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/HostContainerMetrics.java | HostContainerMetrics.updateHostContainerMetrics | public void updateHostContainerMetrics(Map<Host, Set<Integer>> oldMapping, Map<Host, Set<Integer>> newMapping) {
if (newMapping == null) {
// Nothing to do if the new mapping is null.
return;
}
// Report current number of Segment Store hosts with containers.
DYNA... | java | public void updateHostContainerMetrics(Map<Host, Set<Integer>> oldMapping, Map<Host, Set<Integer>> newMapping) {
if (newMapping == null) {
// Nothing to do if the new mapping is null.
return;
}
// Report current number of Segment Store hosts with containers.
DYNA... | [
"public",
"void",
"updateHostContainerMetrics",
"(",
"Map",
"<",
"Host",
",",
"Set",
"<",
"Integer",
">",
">",
"oldMapping",
",",
"Map",
"<",
"Host",
",",
"Set",
"<",
"Integer",
">",
">",
"newMapping",
")",
"{",
"if",
"(",
"newMapping",
"==",
"null",
"... | This method reports the number of available Segment Store hosts managing Containers, as well as the number of
Containers assigned to each host. Moreover, this method also reports failures for hosts and Containers; we
consider a failure the situation in which a host is present in the oldMapping, but not present in newMa... | [
"This",
"method",
"reports",
"the",
"number",
"of",
"available",
"Segment",
"Store",
"hosts",
"managing",
"Containers",
"as",
"well",
"as",
"the",
"number",
"of",
"Containers",
"assigned",
"to",
"each",
"host",
".",
"Moreover",
"this",
"method",
"also",
"repor... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/HostContainerMetrics.java#L38-L66 |
132,307 | pravega/pravega | shared/metrics/src/main/java/io/pravega/shared/metrics/MetricProxy.java | MetricProxy.updateInstance | void updateInstance(T instance) {
T oldInstance = this.instance.getAndSet(Preconditions.checkNotNull(instance, "instance"));
if (oldInstance != null && oldInstance != instance) {
oldInstance.close();
}
} | java | void updateInstance(T instance) {
T oldInstance = this.instance.getAndSet(Preconditions.checkNotNull(instance, "instance"));
if (oldInstance != null && oldInstance != instance) {
oldInstance.close();
}
} | [
"void",
"updateInstance",
"(",
"T",
"instance",
")",
"{",
"T",
"oldInstance",
"=",
"this",
".",
"instance",
".",
"getAndSet",
"(",
"Preconditions",
".",
"checkNotNull",
"(",
"instance",
",",
"\"instance\"",
")",
")",
";",
"if",
"(",
"oldInstance",
"!=",
"n... | Updates the underlying Metric instance with the given one, and closes out the previous one.
@param instance The instance to update to. | [
"Updates",
"the",
"underlying",
"Metric",
"instance",
"with",
"the",
"given",
"one",
"and",
"closes",
"out",
"the",
"previous",
"one",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/metrics/src/main/java/io/pravega/shared/metrics/MetricProxy.java#L66-L71 |
132,308 | pravega/pravega | common/src/main/java/io/pravega/common/util/CollectionHelpers.java | CollectionHelpers.filterOut | public static <T> Collection<T> filterOut(Collection<T> collection, Collection<T> toExclude) {
return collection.stream().filter(o -> !toExclude.contains(o)).collect(Collectors.toList());
} | java | public static <T> Collection<T> filterOut(Collection<T> collection, Collection<T> toExclude) {
return collection.stream().filter(o -> !toExclude.contains(o)).collect(Collectors.toList());
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"filterOut",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"Collection",
"<",
"T",
">",
"toExclude",
")",
"{",
"return",
"collection",
".",
"stream",
"(",
")",
".",
"filter",
"(",
... | Returns a new collection which contains all the items in the given collection that are not to be excluded.
@param collection The collection to check.
@param toExclude The elements to exclude.
@param <T> Type of elements.
@return A new collection containing all items in collection, except those in toExclude. | [
"Returns",
"a",
"new",
"collection",
"which",
"contains",
"all",
"the",
"items",
"in",
"the",
"given",
"collection",
"that",
"are",
"not",
"to",
"be",
"excluded",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/CollectionHelpers.java#L95-L97 |
132,309 | pravega/pravega | common/src/main/java/io/pravega/common/util/CollectionHelpers.java | CollectionHelpers.joinSets | public static <T> Set<T> joinSets(Set<T> set1, Set<T> set2) {
return new NonConvertedSetView<>(set1, set2);
} | java | public static <T> Set<T> joinSets(Set<T> set1, Set<T> set2) {
return new NonConvertedSetView<>(set1, set2);
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"joinSets",
"(",
"Set",
"<",
"T",
">",
"set1",
",",
"Set",
"<",
"T",
">",
"set2",
")",
"{",
"return",
"new",
"NonConvertedSetView",
"<>",
"(",
"set1",
",",
"set2",
")",
";",
"}"
] | Returns an unmodifiable Set View made up of the given Sets. The returned Set View does not copy any of the data from
any of the given Sets, therefore any changes in the two Sets will be reflected in the View.
NOTE: The iterator of this SetView will not de-duplicate items, so if the two Sets are not disjoint, the same ... | [
"Returns",
"an",
"unmodifiable",
"Set",
"View",
"made",
"up",
"of",
"the",
"given",
"Sets",
".",
"The",
"returned",
"Set",
"View",
"does",
"not",
"copy",
"any",
"of",
"the",
"data",
"from",
"any",
"of",
"the",
"given",
"Sets",
"therefore",
"any",
"change... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/CollectionHelpers.java#L111-L113 |
132,310 | pravega/pravega | common/src/main/java/io/pravega/common/util/CollectionHelpers.java | CollectionHelpers.joinSets | public static <OutputType, Type1, Type2> Set<OutputType> joinSets(Set<Type1> set1, Function<Type1, OutputType> converter1,
Set<Type2> set2, Function<Type2, OutputType> converter2) {
return new ConvertedSetView<>(set1, converter1, set2, conver... | java | public static <OutputType, Type1, Type2> Set<OutputType> joinSets(Set<Type1> set1, Function<Type1, OutputType> converter1,
Set<Type2> set2, Function<Type2, OutputType> converter2) {
return new ConvertedSetView<>(set1, converter1, set2, conver... | [
"public",
"static",
"<",
"OutputType",
",",
"Type1",
",",
"Type2",
">",
"Set",
"<",
"OutputType",
">",
"joinSets",
"(",
"Set",
"<",
"Type1",
">",
"set1",
",",
"Function",
"<",
"Type1",
",",
"OutputType",
">",
"converter1",
",",
"Set",
"<",
"Type2",
">"... | Returns an unmodifiable Set View made up of the given Sets while translating the items into a common type. The returned
Set View does not copy any of the data from any of the given Sets, therefore any changes in the two Sets will be
reflected in the View.
NOTE: The iterator of this SetView will not de-duplicate items,... | [
"Returns",
"an",
"unmodifiable",
"Set",
"View",
"made",
"up",
"of",
"the",
"given",
"Sets",
"while",
"translating",
"the",
"items",
"into",
"a",
"common",
"type",
".",
"The",
"returned",
"Set",
"View",
"does",
"not",
"copy",
"any",
"of",
"the",
"data",
"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/CollectionHelpers.java#L132-L135 |
132,311 | pravega/pravega | common/src/main/java/io/pravega/common/util/CollectionHelpers.java | CollectionHelpers.joinCollections | public static <OutputType, Type1, Type2> Collection<OutputType> joinCollections(Collection<Type1> c1, Function<Type1, OutputType> converter1,
Collection<Type2> c2, Function<Type2, OutputType> converter2) {
return new ConvertedSe... | java | public static <OutputType, Type1, Type2> Collection<OutputType> joinCollections(Collection<Type1> c1, Function<Type1, OutputType> converter1,
Collection<Type2> c2, Function<Type2, OutputType> converter2) {
return new ConvertedSe... | [
"public",
"static",
"<",
"OutputType",
",",
"Type1",
",",
"Type2",
">",
"Collection",
"<",
"OutputType",
">",
"joinCollections",
"(",
"Collection",
"<",
"Type1",
">",
"c1",
",",
"Function",
"<",
"Type1",
",",
"OutputType",
">",
"converter1",
",",
"Collection... | Returns an unmodifiable Collection View made up of the given Collections while translating the items into a common type.
The returned Collection View does not copy any of the data from any of the given Collections, therefore any changes
in the two Collections will be reflected in the View.
@param c1 The firs... | [
"Returns",
"an",
"unmodifiable",
"Collection",
"View",
"made",
"up",
"of",
"the",
"given",
"Collections",
"while",
"translating",
"the",
"items",
"into",
"a",
"common",
"type",
".",
"The",
"returned",
"Collection",
"View",
"does",
"not",
"copy",
"any",
"of",
... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/CollectionHelpers.java#L151-L154 |
132,312 | pravega/pravega | controller/src/main/java/io/pravega/controller/eventProcessor/impl/SerializedRequestHandler.java | SerializedRequestHandler.run | private void run(String key, ConcurrentLinkedQueue<Work> workQueue) {
Work work = workQueue.poll();
CompletableFuture<Void> future;
try {
future = processEvent(work.getEvent());
} catch (Exception e) {
future = Futures.failedFuture(e);
}
future.wh... | java | private void run(String key, ConcurrentLinkedQueue<Work> workQueue) {
Work work = workQueue.poll();
CompletableFuture<Void> future;
try {
future = processEvent(work.getEvent());
} catch (Exception e) {
future = Futures.failedFuture(e);
}
future.wh... | [
"private",
"void",
"run",
"(",
"String",
"key",
",",
"ConcurrentLinkedQueue",
"<",
"Work",
">",
"workQueue",
")",
"{",
"Work",
"work",
"=",
"workQueue",
".",
"poll",
"(",
")",
";",
"CompletableFuture",
"<",
"Void",
">",
"future",
";",
"try",
"{",
"future... | Run method is called only if work queue is not empty. So we can safely do a workQueue.poll.
WorkQueue.poll should only happen in the run method and no where else.
@param key key for which we want to process the next event
@param workQueue work queue for the key | [
"Run",
"method",
"is",
"called",
"only",
"if",
"work",
"queue",
"is",
"not",
"empty",
".",
"So",
"we",
"can",
"safely",
"do",
"a",
"workQueue",
".",
"poll",
".",
"WorkQueue",
".",
"poll",
"should",
"only",
"happen",
"in",
"the",
"run",
"method",
"and",... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/eventProcessor/impl/SerializedRequestHandler.java#L88-L110 |
132,313 | pravega/pravega | common/src/main/java/io/pravega/common/util/BlockingDrainingQueue.java | BlockingDrainingQueue.add | public void add(T item) {
CompletableFuture<Queue<T>> pending;
Queue<T> result = null;
synchronized (this.contents) {
Exceptions.checkNotClosed(this.closed, this);
this.contents.addLast(item);
pending = this.pendingTake;
this.pendingTake = null;
... | java | public void add(T item) {
CompletableFuture<Queue<T>> pending;
Queue<T> result = null;
synchronized (this.contents) {
Exceptions.checkNotClosed(this.closed, this);
this.contents.addLast(item);
pending = this.pendingTake;
this.pendingTake = null;
... | [
"public",
"void",
"add",
"(",
"T",
"item",
")",
"{",
"CompletableFuture",
"<",
"Queue",
"<",
"T",
">>",
"pending",
";",
"Queue",
"<",
"T",
">",
"result",
"=",
"null",
";",
"synchronized",
"(",
"this",
".",
"contents",
")",
"{",
"Exceptions",
".",
"ch... | Adds a new item to the queue.
@param item The item to add.
@throws ObjectClosedException If the Queue is closed. | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"queue",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BlockingDrainingQueue.java#L101-L117 |
132,314 | pravega/pravega | common/src/main/java/io/pravega/common/util/BlockingDrainingQueue.java | BlockingDrainingQueue.poll | public Queue<T> poll(int maxCount) {
synchronized (this.contents) {
Exceptions.checkNotClosed(this.closed, this);
Preconditions.checkState(this.pendingTake == null, "Cannot call poll() when there is a pending take() request.");
return fetch(maxCount);
}
} | java | public Queue<T> poll(int maxCount) {
synchronized (this.contents) {
Exceptions.checkNotClosed(this.closed, this);
Preconditions.checkState(this.pendingTake == null, "Cannot call poll() when there is a pending take() request.");
return fetch(maxCount);
}
} | [
"public",
"Queue",
"<",
"T",
">",
"poll",
"(",
"int",
"maxCount",
")",
"{",
"synchronized",
"(",
"this",
".",
"contents",
")",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"this",
".",
"closed",
",",
"this",
")",
";",
"Preconditions",
".",
"checkState"... | Returns the next items from the queue, if any.
@param maxCount The maximum number of items to return.
@return A Queue containing at most maxCount items, or empty if there is nothing in the queue.
@throws IllegalStateException If there is a pending take() operation which hasn't completed yet. | [
"Returns",
"the",
"next",
"items",
"from",
"the",
"queue",
"if",
"any",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BlockingDrainingQueue.java#L126-L132 |
132,315 | pravega/pravega | common/src/main/java/io/pravega/common/util/BlockingDrainingQueue.java | BlockingDrainingQueue.take | public CompletableFuture<Queue<T>> take(int maxCount) {
synchronized (this.contents) {
Exceptions.checkNotClosed(this.closed, this);
Preconditions.checkState(this.pendingTake == null, "Cannot have more than one concurrent pending take() request.");
Queue<T> result = fetch(max... | java | public CompletableFuture<Queue<T>> take(int maxCount) {
synchronized (this.contents) {
Exceptions.checkNotClosed(this.closed, this);
Preconditions.checkState(this.pendingTake == null, "Cannot have more than one concurrent pending take() request.");
Queue<T> result = fetch(max... | [
"public",
"CompletableFuture",
"<",
"Queue",
"<",
"T",
">",
">",
"take",
"(",
"int",
"maxCount",
")",
"{",
"synchronized",
"(",
"this",
".",
"contents",
")",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"this",
".",
"closed",
",",
"this",
")",
";",
"... | Returns the next items from the queue. If the queue is empty, it blocks the call until at least one item is added.
@param maxCount The maximum number of items to return. This argument will be ignored if the queue is currently empty,
but in that case the result will always be completed with exactly one element.
@return... | [
"Returns",
"the",
"next",
"items",
"from",
"the",
"queue",
".",
"If",
"the",
"queue",
"is",
"empty",
"it",
"blocks",
"the",
"call",
"until",
"at",
"least",
"one",
"item",
"is",
"added",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BlockingDrainingQueue.java#L145-L157 |
132,316 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/SegmentStatsRecorderImpl.java | SegmentStatsRecorderImpl.recordAppend | @Override
public void recordAppend(String streamSegmentName, long dataLength, int numOfEvents, Duration elapsed) {
getWriteStreamSegment().reportSuccessEvent(elapsed);
DynamicLogger dl = getDynamicLogger();
dl.incCounterValue(globalMetricName(SEGMENT_WRITE_BYTES), dataLength);
dl.inc... | java | @Override
public void recordAppend(String streamSegmentName, long dataLength, int numOfEvents, Duration elapsed) {
getWriteStreamSegment().reportSuccessEvent(elapsed);
DynamicLogger dl = getDynamicLogger();
dl.incCounterValue(globalMetricName(SEGMENT_WRITE_BYTES), dataLength);
dl.inc... | [
"@",
"Override",
"public",
"void",
"recordAppend",
"(",
"String",
"streamSegmentName",
",",
"long",
"dataLength",
",",
"int",
"numOfEvents",
",",
"Duration",
"elapsed",
")",
"{",
"getWriteStreamSegment",
"(",
")",
".",
"reportSuccessEvent",
"(",
"elapsed",
")",
... | Updates segment specific aggregates.
Then if two minutes have elapsed between last report
of aggregates for this segment, send a new update to the monitor.
This update to the monitor is processed by monitor asynchronously.
@param streamSegmentName stream segment name
@param dataLength length of data that was wr... | [
"Updates",
"segment",
"specific",
"aggregates",
".",
"Then",
"if",
"two",
"minutes",
"have",
"elapsed",
"between",
"last",
"report",
"of",
"aggregates",
"for",
"this",
"segment",
"send",
"a",
"new",
"update",
"to",
"the",
"monitor",
".",
"This",
"update",
"t... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/SegmentStatsRecorderImpl.java#L191-L215 |
132,317 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/SegmentStatsRecorderImpl.java | SegmentStatsRecorderImpl.merge | @Override
public void merge(String streamSegmentName, long dataLength, int numOfEvents, long txnCreationTime) {
getDynamicLogger().incCounterValue(SEGMENT_WRITE_BYTES, dataLength, segmentTags(streamSegmentName));
getDynamicLogger().incCounterValue(SEGMENT_WRITE_EVENTS, numOfEvents, segmentTags(strea... | java | @Override
public void merge(String streamSegmentName, long dataLength, int numOfEvents, long txnCreationTime) {
getDynamicLogger().incCounterValue(SEGMENT_WRITE_BYTES, dataLength, segmentTags(streamSegmentName));
getDynamicLogger().incCounterValue(SEGMENT_WRITE_EVENTS, numOfEvents, segmentTags(strea... | [
"@",
"Override",
"public",
"void",
"merge",
"(",
"String",
"streamSegmentName",
",",
"long",
"dataLength",
",",
"int",
"numOfEvents",
",",
"long",
"txnCreationTime",
")",
"{",
"getDynamicLogger",
"(",
")",
".",
"incCounterValue",
"(",
"SEGMENT_WRITE_BYTES",
",",
... | Method called with txn stats whenever a txn is committed.
@param streamSegmentName parent segment name
@param dataLength length of data written in txn
@param numOfEvents number of events written in txn
@param txnCreationTime time when txn was created | [
"Method",
"called",
"with",
"txn",
"stats",
"whenever",
"a",
"txn",
"is",
"committed",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/SegmentStatsRecorderImpl.java#L225-L234 |
132,318 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/operations/Operation.java | Operation.setSequenceNumber | public void setSequenceNumber(long value) {
Preconditions.checkState(this.sequenceNumber < 0, "Sequence Number has been previously set for this entry. Cannot set a new one.");
Exceptions.checkArgument(value >= 0, "value", "Sequence Number must be a non-negative number.");
this.sequenceNumber = ... | java | public void setSequenceNumber(long value) {
Preconditions.checkState(this.sequenceNumber < 0, "Sequence Number has been previously set for this entry. Cannot set a new one.");
Exceptions.checkArgument(value >= 0, "value", "Sequence Number must be a non-negative number.");
this.sequenceNumber = ... | [
"public",
"void",
"setSequenceNumber",
"(",
"long",
"value",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"sequenceNumber",
"<",
"0",
",",
"\"Sequence Number has been previously set for this entry. Cannot set a new one.\"",
")",
";",
"Exceptions",
".",
... | Sets the Sequence Number for this operation, if not already set.
@param value The Sequence Number to set.
@throws IllegalStateException If the Sequence Number has already been set.
@throws IllegalArgumentException If the Sequence Number is negative. | [
"Sets",
"the",
"Sequence",
"Number",
"for",
"this",
"operation",
"if",
"not",
"already",
"set",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/operations/Operation.java#L61-L66 |
132,319 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/ControllerServiceMain.java | ControllerServiceMain.awaitServiceStarting | @VisibleForTesting
public ControllerServiceStarter awaitServiceStarting() {
monitor.enterWhenUninterruptibly(hasReachedStarting);
try {
if (serviceState != ServiceState.STARTING) {
throw new IllegalStateException("Expected state=" + ServiceState.STARTING +
... | java | @VisibleForTesting
public ControllerServiceStarter awaitServiceStarting() {
monitor.enterWhenUninterruptibly(hasReachedStarting);
try {
if (serviceState != ServiceState.STARTING) {
throw new IllegalStateException("Expected state=" + ServiceState.STARTING +
... | [
"@",
"VisibleForTesting",
"public",
"ControllerServiceStarter",
"awaitServiceStarting",
"(",
")",
"{",
"monitor",
".",
"enterWhenUninterruptibly",
"(",
"hasReachedStarting",
")",
";",
"try",
"{",
"if",
"(",
"serviceState",
"!=",
"ServiceState",
".",
"STARTING",
")",
... | Awaits until the internal state changes to STARTING, and returns the reference
of current ControllerServiceStarter. | [
"Awaits",
"until",
"the",
"internal",
"state",
"changes",
"to",
"STARTING",
"and",
"returns",
"the",
"reference",
"of",
"current",
"ControllerServiceStarter",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/ControllerServiceMain.java#L187-L200 |
132,320 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/ControllerServiceMain.java | ControllerServiceMain.awaitServicePausing | @VisibleForTesting
public ControllerServiceStarter awaitServicePausing() {
monitor.enterWhenUninterruptibly(hasReachedPausing);
try {
if (serviceState != ServiceState.PAUSING) {
throw new IllegalStateException("Expected state=" + ServiceState.PAUSING +
... | java | @VisibleForTesting
public ControllerServiceStarter awaitServicePausing() {
monitor.enterWhenUninterruptibly(hasReachedPausing);
try {
if (serviceState != ServiceState.PAUSING) {
throw new IllegalStateException("Expected state=" + ServiceState.PAUSING +
... | [
"@",
"VisibleForTesting",
"public",
"ControllerServiceStarter",
"awaitServicePausing",
"(",
")",
"{",
"monitor",
".",
"enterWhenUninterruptibly",
"(",
"hasReachedPausing",
")",
";",
"try",
"{",
"if",
"(",
"serviceState",
"!=",
"ServiceState",
".",
"PAUSING",
")",
"{... | Awaits until the internal state changes to PAUSING, and returns the reference
of current ControllerServiceStarter. | [
"Awaits",
"until",
"the",
"internal",
"state",
"changes",
"to",
"PAUSING",
"and",
"returns",
"the",
"reference",
"of",
"current",
"ControllerServiceStarter",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/ControllerServiceMain.java#L206-L219 |
132,321 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrameInputStream.java | DataFrameInputStream.beginRecord | boolean beginRecord() throws IOException, DurableDataLogException {
try {
if (this.currentEntry != null && !this.prefetchedEntry) {
endRecord();
}
fetchNextEntry();
return true;
} catch (NoMoreRecordsException ex) {
// We've re... | java | boolean beginRecord() throws IOException, DurableDataLogException {
try {
if (this.currentEntry != null && !this.prefetchedEntry) {
endRecord();
}
fetchNextEntry();
return true;
} catch (NoMoreRecordsException ex) {
// We've re... | [
"boolean",
"beginRecord",
"(",
")",
"throws",
"IOException",
",",
"DurableDataLogException",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"currentEntry",
"!=",
"null",
"&&",
"!",
"this",
".",
"prefetchedEntry",
")",
"{",
"endRecord",
"(",
")",
";",
"}",
"fetch... | Indicates that a new record is to be expected. When invoked, if in the middle of a record, it will be skipped over
and the DataFrameInputStream will be positioned at the beginning of the next record.
@return True if a new record can be read, false if we reached the end of the DataFrameInputStream and can no longer
rea... | [
"Indicates",
"that",
"a",
"new",
"record",
"is",
"to",
"be",
"expected",
".",
"When",
"invoked",
"if",
"in",
"the",
"middle",
"of",
"a",
"record",
"it",
"will",
"be",
"skipped",
"over",
"and",
"the",
"DataFrameInputStream",
"will",
"be",
"positioned",
"at"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrameInputStream.java#L138-L150 |
132,322 | pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.clear | @Override
public void clear() {
this.root = null;
this.first = null;
this.last = null;
this.size = 0;
this.modCount++;
} | java | @Override
public void clear() {
this.root = null;
this.first = null;
this.last = null;
this.size = 0;
this.modCount++;
} | [
"@",
"Override",
"public",
"void",
"clear",
"(",
")",
"{",
"this",
".",
"root",
"=",
"null",
";",
"this",
".",
"first",
"=",
"null",
";",
"this",
".",
"last",
"=",
"null",
";",
"this",
".",
"size",
"=",
"0",
";",
"this",
".",
"modCount",
"++",
... | region SortedIndex Implementation | [
"region",
"SortedIndex",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L54-L61 |
132,323 | pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.insert | private UpdateResult insert(V item, Node node) {
UpdateResult result;
if (node == null) {
// This is the right location for the item, but there's no node. Create one.
result = new UpdateResult();
result.node = new Node(item);
this.size++;
this.... | java | private UpdateResult insert(V item, Node node) {
UpdateResult result;
if (node == null) {
// This is the right location for the item, but there's no node. Create one.
result = new UpdateResult();
result.node = new Node(item);
this.size++;
this.... | [
"private",
"UpdateResult",
"insert",
"(",
"V",
"item",
",",
"Node",
"node",
")",
"{",
"UpdateResult",
"result",
";",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"// This is the right location for the item, but there's no node. Create one.",
"result",
"=",
"new",
"Upd... | Inserts an item into a subtree.
@param item The item to insert.
@param node The node at the root of the current subtree.
@return The new root of the subtree. | [
"Inserts",
"an",
"item",
"into",
"a",
"subtree",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L260-L291 |
132,324 | pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.delete | private UpdateResult delete(long key, Node node) {
UpdateResult result;
if (node == null) {
// Item not found.
result = new UpdateResult();
} else {
long itemKey = node.item.key();
if (key < itemKey) {
// Given key is smaller than t... | java | private UpdateResult delete(long key, Node node) {
UpdateResult result;
if (node == null) {
// Item not found.
result = new UpdateResult();
} else {
long itemKey = node.item.key();
if (key < itemKey) {
// Given key is smaller than t... | [
"private",
"UpdateResult",
"delete",
"(",
"long",
"key",
",",
"Node",
"node",
")",
"{",
"UpdateResult",
"result",
";",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"// Item not found.",
"result",
"=",
"new",
"UpdateResult",
"(",
")",
";",
"}",
"else",
"{",... | Removes an item with given key from a subtree.
@param key The Key to remove.
@param node The node at the root of the subtree.
@return The new root of the subtree. | [
"Removes",
"an",
"item",
"with",
"given",
"key",
"from",
"a",
"subtree",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L300-L337 |
132,325 | pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.balance | private Node balance(Node node) {
if (node == null) {
return null;
}
int imbalance = getHeight(node.left) - getHeight(node.right);
if (imbalance > MAX_IMBALANCE) {
// Left subtree has higher height than right subtree.
if (getHeight(node.left.left) < g... | java | private Node balance(Node node) {
if (node == null) {
return null;
}
int imbalance = getHeight(node.left) - getHeight(node.right);
if (imbalance > MAX_IMBALANCE) {
// Left subtree has higher height than right subtree.
if (getHeight(node.left.left) < g... | [
"private",
"Node",
"balance",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"imbalance",
"=",
"getHeight",
"(",
"node",
".",
"left",
")",
"-",
"getHeight",
"(",
"node",
".",
"right",
")... | Rebalances the subtree with given root node, if necessary.
@param node The root node of the subtree.
@return The new root node of the subtree. | [
"Rebalances",
"the",
"subtree",
"with",
"given",
"root",
"node",
"if",
"necessary",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L345-L372 |
132,326 | pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.findSmallest | private V findSmallest(Node node) {
if (node == null) {
return null;
}
while (node.left != null) {
node = node.left;
}
return node.item;
} | java | private V findSmallest(Node node) {
if (node == null) {
return null;
}
while (node.left != null) {
node = node.left;
}
return node.item;
} | [
"private",
"V",
"findSmallest",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"while",
"(",
"node",
".",
"left",
"!=",
"null",
")",
"{",
"node",
"=",
"node",
".",
"left",
";",
"}",
"return",... | Finds the smallest item in a subtree.
@param node The root node of the subtree. | [
"Finds",
"the",
"smallest",
"item",
"in",
"a",
"subtree",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L418-L428 |
132,327 | pravega/pravega | common/src/main/java/io/pravega/common/util/AvlTreeIndex.java | AvlTreeIndex.findLargest | private V findLargest(Node node) {
if (node == null) {
return null;
}
while (node.right != null) {
node = node.right;
}
return node.item;
} | java | private V findLargest(Node node) {
if (node == null) {
return null;
}
while (node.right != null) {
node = node.right;
}
return node.item;
} | [
"private",
"V",
"findLargest",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"while",
"(",
"node",
".",
"right",
"!=",
"null",
")",
"{",
"node",
"=",
"node",
".",
"right",
";",
"}",
"return"... | Finds the largest item in a subtree.
@param node The root node of the subtree. | [
"Finds",
"the",
"largest",
"item",
"in",
"a",
"subtree",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/AvlTreeIndex.java#L435-L445 |
132,328 | pravega/pravega | controller/src/main/java/io/pravega/controller/task/TaskBase.java | TaskBase.execute | public <T> CompletableFuture<T> execute(final Resource resource, final Serializable[] parameters, final FutureOperation<T> operation) {
if (!ready) {
return Futures.failedFuture(new IllegalStateException(getClass().getName() + " not yet ready"));
}
final String tag = UUID.randomUUID(... | java | public <T> CompletableFuture<T> execute(final Resource resource, final Serializable[] parameters, final FutureOperation<T> operation) {
if (!ready) {
return Futures.failedFuture(new IllegalStateException(getClass().getName() + " not yet ready"));
}
final String tag = UUID.randomUUID(... | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"execute",
"(",
"final",
"Resource",
"resource",
",",
"final",
"Serializable",
"[",
"]",
"parameters",
",",
"final",
"FutureOperation",
"<",
"T",
">",
"operation",
")",
"{",
"if",
"(",
"!",
"re... | Wrapper method that initially obtains lock then executes the passed method, and finally releases lock.
@param resource resource to be updated by the task.
@param parameters method parameters.
@param operation lambda operation that is the actual task.
@param <T> type parameter of return value of operation to be execute... | [
"Wrapper",
"method",
"that",
"initially",
"obtains",
"lock",
"then",
"executes",
"the",
"passed",
"method",
"and",
"finally",
"releases",
"lock",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/task/TaskBase.java#L106-L142 |
132,329 | pravega/pravega | common/src/main/java/io/pravega/common/hash/HashHelper.java | HashHelper.bytesToUUID | @VisibleForTesting
static UUID bytesToUUID(byte[] data) {
long msb = 0;
long lsb = 0;
assert data.length == 16 : "data must be 16 bytes in length";
for (int i = 0; i < 8; i++) {
msb = (msb << 8) | (data[i] & 0xff);
}
for (int i = 8; i < 16; i++) {
... | java | @VisibleForTesting
static UUID bytesToUUID(byte[] data) {
long msb = 0;
long lsb = 0;
assert data.length == 16 : "data must be 16 bytes in length";
for (int i = 0; i < 8; i++) {
msb = (msb << 8) | (data[i] & 0xff);
}
for (int i = 8; i < 16; i++) {
... | [
"@",
"VisibleForTesting",
"static",
"UUID",
"bytesToUUID",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"long",
"msb",
"=",
"0",
";",
"long",
"lsb",
"=",
"0",
";",
"assert",
"data",
".",
"length",
"==",
"16",
":",
"\"data must be 16 bytes in length\"",
";",
... | Converts a 128 bit array into a UUID.
Copied from UUID's private constructor. | [
"Converts",
"a",
"128",
"bit",
"array",
"into",
"a",
"UUID",
".",
"Copied",
"from",
"UUID",
"s",
"private",
"constructor",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/hash/HashHelper.java#L54-L66 |
132,330 | pravega/pravega | common/src/main/java/io/pravega/common/hash/HashHelper.java | HashHelper.longToDoubleFraction | @VisibleForTesting
static double longToDoubleFraction(long value) {
long shifted = (value >> 12) & MASK;
return Double.longBitsToDouble(LEADING_BITS + shifted) - 1;
} | java | @VisibleForTesting
static double longToDoubleFraction(long value) {
long shifted = (value >> 12) & MASK;
return Double.longBitsToDouble(LEADING_BITS + shifted) - 1;
} | [
"@",
"VisibleForTesting",
"static",
"double",
"longToDoubleFraction",
"(",
"long",
"value",
")",
"{",
"long",
"shifted",
"=",
"(",
"value",
">>",
"12",
")",
"&",
"MASK",
";",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"LEADING_BITS",
"+",
"shifted",
"... | Turns the leading 54 bits of a long into a double between 0 and 1.
@param value The input. | [
"Turns",
"the",
"leading",
"54",
"bits",
"of",
"a",
"long",
"into",
"a",
"double",
"between",
"0",
"and",
"1",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/hash/HashHelper.java#L101-L105 |
132,331 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/AsyncReadResultProcessor.java | AsyncReadResultProcessor.process | public static AsyncReadResultProcessor process(ReadResult readResult, AsyncReadResultHandler entryHandler, Executor executor) {
Preconditions.checkNotNull(executor, "executor");
AsyncReadResultProcessor processor = new AsyncReadResultProcessor(readResult, entryHandler);
processor.processResult(e... | java | public static AsyncReadResultProcessor process(ReadResult readResult, AsyncReadResultHandler entryHandler, Executor executor) {
Preconditions.checkNotNull(executor, "executor");
AsyncReadResultProcessor processor = new AsyncReadResultProcessor(readResult, entryHandler);
processor.processResult(e... | [
"public",
"static",
"AsyncReadResultProcessor",
"process",
"(",
"ReadResult",
"readResult",
",",
"AsyncReadResultHandler",
"entryHandler",
",",
"Executor",
"executor",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"executor",
",",
"\"executor\"",
")",
";",
"Asy... | Processes the given ReadResult using the given AsyncReadResultHandler.
@param readResult The ReadResult to process.
@param entryHandler An AsyncReadResultHandler to be used for callbacks.
@param executor An Executor to run asynchronous tasks on.
@return An instance of the AsyncReadResultProcessor that is process... | [
"Processes",
"the",
"given",
"ReadResult",
"using",
"the",
"given",
"AsyncReadResultHandler",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/AsyncReadResultProcessor.java#L84-L89 |
132,332 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java | ContainerKeyCache.getCacheStatus | @Override
public CacheManager.CacheStatus getCacheStatus() {
int minGen = 0;
int maxGen = 0;
long size = 0;
synchronized (this.segmentCaches) {
for (SegmentKeyCache e : this.segmentCaches.values()) {
if (e != null) {
val cs = e.getCache... | java | @Override
public CacheManager.CacheStatus getCacheStatus() {
int minGen = 0;
int maxGen = 0;
long size = 0;
synchronized (this.segmentCaches) {
for (SegmentKeyCache e : this.segmentCaches.values()) {
if (e != null) {
val cs = e.getCache... | [
"@",
"Override",
"public",
"CacheManager",
".",
"CacheStatus",
"getCacheStatus",
"(",
")",
"{",
"int",
"minGen",
"=",
"0",
";",
"int",
"maxGen",
"=",
"0",
";",
"long",
"size",
"=",
"0",
";",
"synchronized",
"(",
"this",
".",
"segmentCaches",
")",
"{",
... | region CacheManager.Client Implementation | [
"region",
"CacheManager",
".",
"Client",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L76-L93 |
132,333 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java | ContainerKeyCache.get | CacheBucketOffset get(long segmentId, UUID keyHash) {
SegmentKeyCache cache;
int generation;
synchronized (this.segmentCaches) {
generation = this.currentCacheGeneration;
cache = this.segmentCaches.get(segmentId);
}
return cache == null ? null : cache.get... | java | CacheBucketOffset get(long segmentId, UUID keyHash) {
SegmentKeyCache cache;
int generation;
synchronized (this.segmentCaches) {
generation = this.currentCacheGeneration;
cache = this.segmentCaches.get(segmentId);
}
return cache == null ? null : cache.get... | [
"CacheBucketOffset",
"get",
"(",
"long",
"segmentId",
",",
"UUID",
"keyHash",
")",
"{",
"SegmentKeyCache",
"cache",
";",
"int",
"generation",
";",
"synchronized",
"(",
"this",
".",
"segmentCaches",
")",
"{",
"generation",
"=",
"this",
".",
"currentCacheGeneratio... | Looks up a cached offset for the given Segment and Key Hash.
@param segmentId The Id of the Segment to look up for.
@param keyHash A UUID representing the Key Hash to look up.
@return A {@link CacheBucketOffset} representing the sought result. | [
"Looks",
"up",
"a",
"cached",
"offset",
"for",
"the",
"given",
"Segment",
"and",
"Key",
"Hash",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L172-L181 |
132,334 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java | ContainerKeyCache.getTailHashes | Map<UUID, CacheBucketOffset> getTailHashes(long segmentId) {
return forSegmentCache(segmentId, SegmentKeyCache::getTailBucketOffsets, Collections.emptyMap());
} | java | Map<UUID, CacheBucketOffset> getTailHashes(long segmentId) {
return forSegmentCache(segmentId, SegmentKeyCache::getTailBucketOffsets, Collections.emptyMap());
} | [
"Map",
"<",
"UUID",
",",
"CacheBucketOffset",
">",
"getTailHashes",
"(",
"long",
"segmentId",
")",
"{",
"return",
"forSegmentCache",
"(",
"segmentId",
",",
"SegmentKeyCache",
"::",
"getTailBucketOffsets",
",",
"Collections",
".",
"emptyMap",
"(",
")",
")",
";",
... | Gets the unindexed Key Hashes, mapped to their latest offsets.
@param segmentId The Id of the Segment to get Hashes for.
@return The result. | [
"Gets",
"the",
"unindexed",
"Key",
"Hashes",
"mapped",
"to",
"their",
"latest",
"offsets",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L264-L266 |
132,335 | pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/ZKScope.java | ZKScope.addStreamToScope | CompletableFuture<Void> addStreamToScope(String name, int streamPosition) {
// break the path from stream position into three parts --> 2, 4, 4
String path = getPathForStreamPosition(name, streamPosition);
return Futures.toVoid(store.createZNodeIfNotExist(path));
} | java | CompletableFuture<Void> addStreamToScope(String name, int streamPosition) {
// break the path from stream position into three parts --> 2, 4, 4
String path = getPathForStreamPosition(name, streamPosition);
return Futures.toVoid(store.createZNodeIfNotExist(path));
} | [
"CompletableFuture",
"<",
"Void",
">",
"addStreamToScope",
"(",
"String",
"name",
",",
"int",
"streamPosition",
")",
"{",
"// break the path from stream position into three parts --> 2, 4, 4",
"String",
"path",
"=",
"getPathForStreamPosition",
"(",
"name",
",",
"streamPosit... | Streams are ordered under the scope in the order of stream position.
The metadata store first calls `getNextStreamPosition` method to generate a new position.
This position is assigned to the stream and a reference to this stream is stored under the scope at the said position.
ZkScope takes this position number and br... | [
"Streams",
"are",
"ordered",
"under",
"the",
"scope",
"in",
"the",
"order",
"of",
"stream",
"position",
".",
"The",
"metadata",
"store",
"first",
"calls",
"getNextStreamPosition",
"method",
"to",
"generate",
"a",
"new",
"position",
".",
"This",
"position",
"is... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/ZKScope.java#L100-L104 |
132,336 | pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/ZKScope.java | ZKScope.getNextStreamPosition | CompletableFuture<Integer> getNextStreamPosition() {
return store.createEphemeralSequentialZNode(counterPath)
.thenApply(counterStr -> Integer.parseInt(counterStr.replace(counterPath, "")));
} | java | CompletableFuture<Integer> getNextStreamPosition() {
return store.createEphemeralSequentialZNode(counterPath)
.thenApply(counterStr -> Integer.parseInt(counterStr.replace(counterPath, "")));
} | [
"CompletableFuture",
"<",
"Integer",
">",
"getNextStreamPosition",
"(",
")",
"{",
"return",
"store",
".",
"createEphemeralSequentialZNode",
"(",
"counterPath",
")",
".",
"thenApply",
"(",
"counterStr",
"->",
"Integer",
".",
"parseInt",
"(",
"counterStr",
".",
"rep... | When a new stream is created under a scope, we first get a new counter value by creating a sequential znode under
a counter node. this is a 10 digit integer which the store passes to the zkscope object as position.
@return A future which when completed has the next stream position represented by an integer. | [
"When",
"a",
"new",
"stream",
"is",
"created",
"under",
"a",
"scope",
"we",
"first",
"get",
"a",
"new",
"counter",
"value",
"by",
"creating",
"a",
"sequential",
"znode",
"under",
"a",
"counter",
"node",
".",
"this",
"is",
"a",
"10",
"digit",
"integer",
... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/ZKScope.java#L221-L224 |
132,337 | pravega/pravega | segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/HandleSerializer.java | HandleSerializer.deserialize | static RollingSegmentHandle deserialize(byte[] serialization, SegmentHandle headerHandle) {
StringTokenizer st = new StringTokenizer(new String(serialization, ENCODING), SEPARATOR, false);
Preconditions.checkArgument(st.hasMoreTokens(), "No separators in serialization.");
SegmentRollingPolicy p... | java | static RollingSegmentHandle deserialize(byte[] serialization, SegmentHandle headerHandle) {
StringTokenizer st = new StringTokenizer(new String(serialization, ENCODING), SEPARATOR, false);
Preconditions.checkArgument(st.hasMoreTokens(), "No separators in serialization.");
SegmentRollingPolicy p... | [
"static",
"RollingSegmentHandle",
"deserialize",
"(",
"byte",
"[",
"]",
"serialization",
",",
"SegmentHandle",
"headerHandle",
")",
"{",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"new",
"String",
"(",
"serialization",
",",
"ENCODING",
")",
",",
... | Deserializes the given byte array into a RollingSegmentHandle.
@param serialization The byte array to deserialize.
@param headerHandle The SegmentHandle for the Header file.
@return A new instance of the RollingSegmentHandle class. | [
"Deserializes",
"the",
"given",
"byte",
"array",
"into",
"a",
"RollingSegmentHandle",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/HandleSerializer.java#L52-L87 |
132,338 | pravega/pravega | segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/HandleSerializer.java | HandleSerializer.serialize | @SneakyThrows(IOException.class)
static ByteArraySegment serialize(RollingSegmentHandle handle) {
try (EnhancedByteArrayOutputStream os = new EnhancedByteArrayOutputStream()) {
//1. Policy Max Size.
os.write(combine(KEY_POLICY_MAX_SIZE, Long.toString(handle.getRollingPolicy().getMaxL... | java | @SneakyThrows(IOException.class)
static ByteArraySegment serialize(RollingSegmentHandle handle) {
try (EnhancedByteArrayOutputStream os = new EnhancedByteArrayOutputStream()) {
//1. Policy Max Size.
os.write(combine(KEY_POLICY_MAX_SIZE, Long.toString(handle.getRollingPolicy().getMaxL... | [
"@",
"SneakyThrows",
"(",
"IOException",
".",
"class",
")",
"static",
"ByteArraySegment",
"serialize",
"(",
"RollingSegmentHandle",
"handle",
")",
"{",
"try",
"(",
"EnhancedByteArrayOutputStream",
"os",
"=",
"new",
"EnhancedByteArrayOutputStream",
"(",
")",
")",
"{"... | Serializes an entire RollingSegmentHandle into a new ByteArraySegment.
@param handle The RollingSegmentHandle to serialize.
@return A ByteArraySegment with the serialization. | [
"Serializes",
"an",
"entire",
"RollingSegmentHandle",
"into",
"a",
"new",
"ByteArraySegment",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/HandleSerializer.java#L95-L104 |
132,339 | pravega/pravega | segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/HandleSerializer.java | HandleSerializer.serializeChunk | static byte[] serializeChunk(SegmentChunk segmentChunk) {
return combine(Long.toString(segmentChunk.getStartOffset()), segmentChunk.getName());
} | java | static byte[] serializeChunk(SegmentChunk segmentChunk) {
return combine(Long.toString(segmentChunk.getStartOffset()), segmentChunk.getName());
} | [
"static",
"byte",
"[",
"]",
"serializeChunk",
"(",
"SegmentChunk",
"segmentChunk",
")",
"{",
"return",
"combine",
"(",
"Long",
".",
"toString",
"(",
"segmentChunk",
".",
"getStartOffset",
"(",
")",
")",
",",
"segmentChunk",
".",
"getName",
"(",
")",
")",
"... | Serializes a single SegmentChunk.
@param segmentChunk The SegmentChunk to serialize.
@return A byte array containing the serialization. | [
"Serializes",
"a",
"single",
"SegmentChunk",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/HandleSerializer.java#L112-L114 |
132,340 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableCompactor.java | TableCompactor.isCompactionRequired | boolean isCompactionRequired(SegmentProperties info) {
long startOffset = getCompactionStartOffset(info);
long lastIndexOffset = this.indexReader.getLastIndexedOffset(info);
if (startOffset + this.connector.getMaxCompactionSize() >= lastIndexOffset) {
// Either:
// 1. Not... | java | boolean isCompactionRequired(SegmentProperties info) {
long startOffset = getCompactionStartOffset(info);
long lastIndexOffset = this.indexReader.getLastIndexedOffset(info);
if (startOffset + this.connector.getMaxCompactionSize() >= lastIndexOffset) {
// Either:
// 1. Not... | [
"boolean",
"isCompactionRequired",
"(",
"SegmentProperties",
"info",
")",
"{",
"long",
"startOffset",
"=",
"getCompactionStartOffset",
"(",
"info",
")",
";",
"long",
"lastIndexOffset",
"=",
"this",
".",
"indexReader",
".",
"getLastIndexedOffset",
"(",
"info",
")",
... | Determines if Table Compaction is required on a Table Segment.
@param info The {@link SegmentProperties} associated with the Table Segment to inquire about.
@return True if compaction is required, false otherwise. | [
"Determines",
"if",
"Table",
"Compaction",
"is",
"required",
"on",
"a",
"Table",
"Segment",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableCompactor.java#L85-L101 |
132,341 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableCompactor.java | TableCompactor.calculateTruncationOffset | long calculateTruncationOffset(SegmentProperties info, long highestCopiedOffset) {
long truncateOffset = -1;
if (highestCopiedOffset > 0) {
// Due to the nature of compaction (all entries are copied in order of their original versions), if we encounter
// any copied Table Entries... | java | long calculateTruncationOffset(SegmentProperties info, long highestCopiedOffset) {
long truncateOffset = -1;
if (highestCopiedOffset > 0) {
// Due to the nature of compaction (all entries are copied in order of their original versions), if we encounter
// any copied Table Entries... | [
"long",
"calculateTruncationOffset",
"(",
"SegmentProperties",
"info",
",",
"long",
"highestCopiedOffset",
")",
"{",
"long",
"truncateOffset",
"=",
"-",
"1",
";",
"if",
"(",
"highestCopiedOffset",
">",
"0",
")",
"{",
"// Due to the nature of compaction (all entries are ... | Calculates the offset in the Segment where it is safe to truncate based on the current state of the Segment and
the highest copied offset encountered during an index update.
This method is invoked from the {@link WriterTableProcessor} after indexing. Since compaction is loosely coupled
with indexing, the {@link Writer... | [
"Calculates",
"the",
"offset",
"in",
"the",
"Segment",
"where",
"it",
"is",
"safe",
"to",
"truncate",
"based",
"on",
"the",
"current",
"state",
"of",
"the",
"Segment",
"and",
"the",
"highest",
"copied",
"offset",
"encountered",
"during",
"an",
"index",
"upda... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableCompactor.java#L125-L143 |
132,342 | pravega/pravega | bindings/src/main/java/io/pravega/storage/extendeds3/ExtendedS3Storage.java | ExtendedS3Storage.doOpenRead | private SegmentHandle doOpenRead(String streamSegmentName) {
long traceId = LoggerHelpers.traceEnter(log, "openRead", streamSegmentName);
doGetStreamSegmentInfo(streamSegmentName);
ExtendedS3SegmentHandle retHandle = ExtendedS3SegmentHandle.getReadHandle(streamSegmentName);
LoggerHelper... | java | private SegmentHandle doOpenRead(String streamSegmentName) {
long traceId = LoggerHelpers.traceEnter(log, "openRead", streamSegmentName);
doGetStreamSegmentInfo(streamSegmentName);
ExtendedS3SegmentHandle retHandle = ExtendedS3SegmentHandle.getReadHandle(streamSegmentName);
LoggerHelper... | [
"private",
"SegmentHandle",
"doOpenRead",
"(",
"String",
"streamSegmentName",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnter",
"(",
"log",
",",
"\"openRead\"",
",",
"streamSegmentName",
")",
";",
"doGetStreamSegmentInfo",
"(",
"streamSegmentName",... | region private sync implementation | [
"region",
"private",
"sync",
"implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/bindings/src/main/java/io/pravega/storage/extendeds3/ExtendedS3Storage.java#L185-L192 |
132,343 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/rocksdb/RocksDBCacheFactory.java | RocksDBCacheFactory.getCache | @Override
public Cache getCache(String id) {
Exceptions.checkNotClosed(this.closed.get(), this);
RocksDBCache result;
boolean isNew = false;
synchronized (this.caches) {
result = this.caches.get(id);
if (result == null) {
result = new RocksDBC... | java | @Override
public Cache getCache(String id) {
Exceptions.checkNotClosed(this.closed.get(), this);
RocksDBCache result;
boolean isNew = false;
synchronized (this.caches) {
result = this.caches.get(id);
if (result == null) {
result = new RocksDBC... | [
"@",
"Override",
"public",
"Cache",
"getCache",
"(",
"String",
"id",
")",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"this",
".",
"closed",
".",
"get",
"(",
")",
",",
"this",
")",
";",
"RocksDBCache",
"result",
";",
"boolean",
"isNew",
"=",
"false",
... | region CacheFactory Implementation | [
"region",
"CacheFactory",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/rocksdb/RocksDBCacheFactory.java#L79-L99 |
132,344 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java | SegmentAttributeBTreeIndex.initialize | CompletableFuture<Void> initialize(Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
Preconditions.checkState(!this.index.isInitialized(), "SegmentAttributeIndex is already initialized.");
String attributeSegmentName = StreamSegmentNameUtils.getAttributeSegmentName(this.segment... | java | CompletableFuture<Void> initialize(Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
Preconditions.checkState(!this.index.isInitialized(), "SegmentAttributeIndex is already initialized.");
String attributeSegmentName = StreamSegmentNameUtils.getAttributeSegmentName(this.segment... | [
"CompletableFuture",
"<",
"Void",
">",
"initialize",
"(",
"Duration",
"timeout",
")",
"{",
"TimeoutTimer",
"timer",
"=",
"new",
"TimeoutTimer",
"(",
"timeout",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"!",
"this",
".",
"index",
".",
"isInitialized",
... | Initializes the SegmentAttributeIndex by inspecting the AttributeSegmentFile and creating it if needed.
@param timeout Timeout for the operation.
@return A CompletableFuture that, when completed, will indicate the operation has succeeded. | [
"Initializes",
"the",
"SegmentAttributeIndex",
"by",
"inspecting",
"the",
"AttributeSegmentFile",
"and",
"creating",
"it",
"if",
"needed",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L152-L166 |
132,345 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java | SegmentAttributeBTreeIndex.delete | static CompletableFuture<Void> delete(String segmentName, Storage storage, Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
String attributeSegmentName = StreamSegmentNameUtils.getAttributeSegmentName(segmentName);
return Futures.exceptionallyExpecting(
storage... | java | static CompletableFuture<Void> delete(String segmentName, Storage storage, Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
String attributeSegmentName = StreamSegmentNameUtils.getAttributeSegmentName(segmentName);
return Futures.exceptionallyExpecting(
storage... | [
"static",
"CompletableFuture",
"<",
"Void",
">",
"delete",
"(",
"String",
"segmentName",
",",
"Storage",
"storage",
",",
"Duration",
"timeout",
")",
"{",
"TimeoutTimer",
"timer",
"=",
"new",
"TimeoutTimer",
"(",
"timeout",
")",
";",
"String",
"attributeSegmentNa... | Deletes all the Attribute data associated with the given Segment.
@param segmentName The name of the Segment whose attribute data should be deleted.
@param storage A Storage Adapter to execute the deletion on.
@param timeout Timeout for the operation.
@return A CompletableFuture that, when completed, will indi... | [
"Deletes",
"all",
"the",
"Attribute",
"data",
"associated",
"with",
"the",
"given",
"Segment",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L176-L184 |
132,346 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java | SegmentAttributeBTreeIndex.close | void close(boolean cleanCache) {
if (!this.closed.getAndSet(true)) {
// Close storage reader (and thus cancel those reads).
if (cleanCache) {
this.executor.execute(() -> {
removeAllCacheEntries();
log.info("{}: Closed.", this.traceO... | java | void close(boolean cleanCache) {
if (!this.closed.getAndSet(true)) {
// Close storage reader (and thus cancel those reads).
if (cleanCache) {
this.executor.execute(() -> {
removeAllCacheEntries();
log.info("{}: Closed.", this.traceO... | [
"void",
"close",
"(",
"boolean",
"cleanCache",
")",
"{",
"if",
"(",
"!",
"this",
".",
"closed",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"// Close storage reader (and thus cancel those reads).",
"if",
"(",
"cleanCache",
")",
"{",
"this",
".",
"executor",
... | Closes the SegmentAttributeIndex and optionally cleans the cache.
@param cleanCache If true, the Cache will be cleaned up of all entries pertaining to this Index. If false, the
Cache will not be touched. | [
"Closes",
"the",
"SegmentAttributeIndex",
"and",
"optionally",
"cleans",
"the",
"cache",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L203-L215 |
132,347 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java | SegmentAttributeBTreeIndex.getCacheStatus | @Override
public CacheManager.CacheStatus getCacheStatus() {
int minGen = 0;
int maxGen = 0;
long size = 0;
synchronized (this.cacheEntries) {
for (CacheEntry e : this.cacheEntries.values()) {
if (e != null) {
int g = e.getGeneration();... | java | @Override
public CacheManager.CacheStatus getCacheStatus() {
int minGen = 0;
int maxGen = 0;
long size = 0;
synchronized (this.cacheEntries) {
for (CacheEntry e : this.cacheEntries.values()) {
if (e != null) {
int g = e.getGeneration();... | [
"@",
"Override",
"public",
"CacheManager",
".",
"CacheStatus",
"getCacheStatus",
"(",
")",
"{",
"int",
"minGen",
"=",
"0",
";",
"int",
"maxGen",
"=",
"0",
";",
"long",
"size",
"=",
"0",
";",
"synchronized",
"(",
"this",
".",
"cacheEntries",
")",
"{",
"... | region CacheManager.Client implementation | [
"region",
"CacheManager",
".",
"Client",
"implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L238-L255 |
132,348 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java | SegmentAttributeBTreeIndex.executeConditionally | private CompletableFuture<Void> executeConditionally(Function<Duration, CompletableFuture<Long>> indexOperation, Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
return UPDATE_RETRY
.runAsync(() -> executeConditionallyOnce(indexOperation, timer), this.executor)
... | java | private CompletableFuture<Void> executeConditionally(Function<Duration, CompletableFuture<Long>> indexOperation, Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
return UPDATE_RETRY
.runAsync(() -> executeConditionallyOnce(indexOperation, timer), this.executor)
... | [
"private",
"CompletableFuture",
"<",
"Void",
">",
"executeConditionally",
"(",
"Function",
"<",
"Duration",
",",
"CompletableFuture",
"<",
"Long",
">",
">",
"indexOperation",
",",
"Duration",
"timeout",
")",
"{",
"TimeoutTimer",
"timer",
"=",
"new",
"TimeoutTimer"... | Executes the given Index Operation with retries. Retries are only performed in case of conditional update failures,
represented by BadOffsetException.
@param indexOperation A Function, that, when invoked, returns a CompletableFuture which indicates when the index
operation completes.
@param timeout Timeout for ... | [
"Executes",
"the",
"given",
"Index",
"Operation",
"with",
"retries",
".",
"Retries",
"are",
"only",
"performed",
"in",
"case",
"of",
"conditional",
"update",
"failures",
"represented",
"by",
"BadOffsetException",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L372-L378 |
132,349 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MetadataCheckpointPolicy.java | MetadataCheckpointPolicy.recordCommit | public synchronized void recordCommit(int commitLength) {
Preconditions.checkArgument(commitLength >= 0, "commitLength must be a non-negative number.");
// Update counters.
this.commitCount++;
this.accumulatedLength += commitLength;
int minCount = this.config.getCheckpointMinCo... | java | public synchronized void recordCommit(int commitLength) {
Preconditions.checkArgument(commitLength >= 0, "commitLength must be a non-negative number.");
// Update counters.
this.commitCount++;
this.accumulatedLength += commitLength;
int minCount = this.config.getCheckpointMinCo... | [
"public",
"synchronized",
"void",
"recordCommit",
"(",
"int",
"commitLength",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"commitLength",
">=",
"0",
",",
"\"commitLength must be a non-negative number.\"",
")",
";",
"// Update counters.",
"this",
".",
"commitCo... | Records that an operation with the given data length has been processed.
@param commitLength The length of the commit (i.e., DataFrame). | [
"Records",
"that",
"an",
"operation",
"with",
"the",
"given",
"data",
"length",
"has",
"been",
"processed",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MetadataCheckpointPolicy.java#L72-L90 |
132,350 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final UUID encode(final TxnId txnId) {
Preconditions.checkNotNull(txnId, "txnId");
return new UUID(txnId.getHighBits(), txnId.getLowBits());
} | java | public static final UUID encode(final TxnId txnId) {
Preconditions.checkNotNull(txnId, "txnId");
return new UUID(txnId.getHighBits(), txnId.getLowBits());
} | [
"public",
"static",
"final",
"UUID",
"encode",
"(",
"final",
"TxnId",
"txnId",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"txnId",
",",
"\"txnId\"",
")",
";",
"return",
"new",
"UUID",
"(",
"txnId",
".",
"getHighBits",
"(",
")",
",",
"txnId",
".... | Returns UUID of transaction with given TxnId.
@param txnId The Transaction Id.
@return UUID of the transaction. | [
"Returns",
"UUID",
"of",
"transaction",
"with",
"given",
"TxnId",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L51-L54 |
132,351 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final Segment encode(final SegmentId segment) {
Preconditions.checkNotNull(segment, "segment");
return new Segment(segment.getStreamInfo().getScope(),
segment.getStreamInfo().getStream(),
segment.getSegmentId());
} | java | public static final Segment encode(final SegmentId segment) {
Preconditions.checkNotNull(segment, "segment");
return new Segment(segment.getStreamInfo().getScope(),
segment.getStreamInfo().getStream(),
segment.getSegmentId());
} | [
"public",
"static",
"final",
"Segment",
"encode",
"(",
"final",
"SegmentId",
"segment",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"segment",
",",
"\"segment\"",
")",
";",
"return",
"new",
"Segment",
"(",
"segment",
".",
"getStreamInfo",
"(",
")",
... | Helper to convert Segment Id into Segment object.
@param segment The Segment Id.
@return New instance of Segment. | [
"Helper",
"to",
"convert",
"Segment",
"Id",
"into",
"Segment",
"object",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L62-L67 |
132,352 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final RetentionPolicy encode(final Controller.RetentionPolicy policy) {
// Using default enum type of UNKNOWN(0) to detect if retention policy has been set or not.
// This is required since proto3 does not have any other way to detect if a field has been set or not.
if (policy != n... | java | public static final RetentionPolicy encode(final Controller.RetentionPolicy policy) {
// Using default enum type of UNKNOWN(0) to detect if retention policy has been set or not.
// This is required since proto3 does not have any other way to detect if a field has been set or not.
if (policy != n... | [
"public",
"static",
"final",
"RetentionPolicy",
"encode",
"(",
"final",
"Controller",
".",
"RetentionPolicy",
"policy",
")",
"{",
"// Using default enum type of UNKNOWN(0) to detect if retention policy has been set or not.",
"// This is required since proto3 does not have any other way t... | Helper to convert retention policy from RPC call to internal representation.
@param policy The retention policy from RPC interface.
@return New instance of RetentionPolicy. | [
"Helper",
"to",
"convert",
"retention",
"policy",
"from",
"RPC",
"call",
"to",
"internal",
"representation",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L85-L96 |
132,353 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final StreamConfiguration encode(final StreamConfig config) {
Preconditions.checkNotNull(config, "config");
return StreamConfiguration.builder()
.scalingPolicy(encode(config.getScalingPolicy()))
.retentionPolicy(encode(config.getRetentionPolicy()))
... | java | public static final StreamConfiguration encode(final StreamConfig config) {
Preconditions.checkNotNull(config, "config");
return StreamConfiguration.builder()
.scalingPolicy(encode(config.getScalingPolicy()))
.retentionPolicy(encode(config.getRetentionPolicy()))
... | [
"public",
"static",
"final",
"StreamConfiguration",
"encode",
"(",
"final",
"StreamConfig",
"config",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"config",
",",
"\"config\"",
")",
";",
"return",
"StreamConfiguration",
".",
"builder",
"(",
")",
".",
"sca... | Helper to convert StreamConfig into Stream Configuration Impl.
@param config The StreamConfig
@return New instance of StreamConfiguration Impl. | [
"Helper",
"to",
"convert",
"StreamConfig",
"into",
"Stream",
"Configuration",
"Impl",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L104-L110 |
132,354 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final PravegaNodeUri encode(final NodeUri uri) {
Preconditions.checkNotNull(uri, "uri");
return new PravegaNodeUri(uri.getEndpoint(), uri.getPort());
} | java | public static final PravegaNodeUri encode(final NodeUri uri) {
Preconditions.checkNotNull(uri, "uri");
return new PravegaNodeUri(uri.getEndpoint(), uri.getPort());
} | [
"public",
"static",
"final",
"PravegaNodeUri",
"encode",
"(",
"final",
"NodeUri",
"uri",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"uri",
",",
"\"uri\"",
")",
";",
"return",
"new",
"PravegaNodeUri",
"(",
"uri",
".",
"getEndpoint",
"(",
")",
",",
... | Helper to convert NodeURI into PravegaNodeURI.
@param uri Node URI.
@return PravegaNodeURI. | [
"Helper",
"to",
"convert",
"NodeURI",
"into",
"PravegaNodeURI",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L118-L121 |
132,355 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final List<Map.Entry<Double, Double>> encode(final Map<Double, Double> keyRanges) {
Preconditions.checkNotNull(keyRanges, "keyRanges");
return keyRanges
.entrySet()
.stream()
.map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue()))... | java | public static final List<Map.Entry<Double, Double>> encode(final Map<Double, Double> keyRanges) {
Preconditions.checkNotNull(keyRanges, "keyRanges");
return keyRanges
.entrySet()
.stream()
.map(x -> new AbstractMap.SimpleEntry<>(x.getKey(), x.getValue()))... | [
"public",
"static",
"final",
"List",
"<",
"Map",
".",
"Entry",
"<",
"Double",
",",
"Double",
">",
">",
"encode",
"(",
"final",
"Map",
"<",
"Double",
",",
"Double",
">",
"keyRanges",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"keyRanges",
",",
... | Return list of key ranges available.
@param keyRanges List of Key Value pairs.
@return Collection of key ranges available. | [
"Return",
"list",
"of",
"key",
"ranges",
"available",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L129-L137 |
132,356 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final Transaction.Status encode(final TxnState.State state, final String logString) {
Preconditions.checkNotNull(state, "state");
Exceptions.checkNotNullOrEmpty(logString, "logString");
Transaction.Status result;
switch (state) {
case COMMITTED:
... | java | public static final Transaction.Status encode(final TxnState.State state, final String logString) {
Preconditions.checkNotNull(state, "state");
Exceptions.checkNotNullOrEmpty(logString, "logString");
Transaction.Status result;
switch (state) {
case COMMITTED:
... | [
"public",
"static",
"final",
"Transaction",
".",
"Status",
"encode",
"(",
"final",
"TxnState",
".",
"State",
"state",
",",
"final",
"String",
"logString",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"state",
",",
"\"state\"",
")",
";",
"Exceptions",
... | Returns actual status of given transaction status instance.
@param state TxnState object instance.
@param logString Description text to be logged when transaction status is invalid.
@return Transaction.Status | [
"Returns",
"actual",
"status",
"of",
"given",
"transaction",
"status",
"instance",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L146-L174 |
132,357 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final Transaction.PingStatus encode(final Controller.PingTxnStatus.Status status, final String logString)
throws PingFailedException {
Preconditions.checkNotNull(status, "status");
Exceptions.checkNotNullOrEmpty(logString, "logString");
Transaction.PingStatus result;
... | java | public static final Transaction.PingStatus encode(final Controller.PingTxnStatus.Status status, final String logString)
throws PingFailedException {
Preconditions.checkNotNull(status, "status");
Exceptions.checkNotNullOrEmpty(logString, "logString");
Transaction.PingStatus result;
... | [
"public",
"static",
"final",
"Transaction",
".",
"PingStatus",
"encode",
"(",
"final",
"Controller",
".",
"PingTxnStatus",
".",
"Status",
"status",
",",
"final",
"String",
"logString",
")",
"throws",
"PingFailedException",
"{",
"Preconditions",
".",
"checkNotNull",
... | Returns the status of Ping Transaction.
@param status PingTxnStatus object instance.
@param logString Description text to be logged when ping transaction status is invalid.
@return Transaction.PingStatus
@throws PingFailedException if status of Ping transaction operations is not successful. | [
"Returns",
"the",
"status",
"of",
"Ping",
"Transaction",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L184-L203 |
132,358 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final SegmentWithRange encode(final SegmentRange segmentRange) {
return new SegmentWithRange(encode(segmentRange.getSegmentId()), segmentRange.getMinKey(), segmentRange
.getMaxKey());
} | java | public static final SegmentWithRange encode(final SegmentRange segmentRange) {
return new SegmentWithRange(encode(segmentRange.getSegmentId()), segmentRange.getMinKey(), segmentRange
.getMaxKey());
} | [
"public",
"static",
"final",
"SegmentWithRange",
"encode",
"(",
"final",
"SegmentRange",
"segmentRange",
")",
"{",
"return",
"new",
"SegmentWithRange",
"(",
"encode",
"(",
"segmentRange",
".",
"getSegmentId",
"(",
")",
")",
",",
"segmentRange",
".",
"getMinKey",
... | Helper to convert SegmentRange to SegmentWithRange.
@param segmentRange segmentRange
@return SegmentWithRange | [
"Helper",
"to",
"convert",
"SegmentRange",
"to",
"SegmentWithRange",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L211-L214 |
132,359 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static final TxnId decode(final UUID txnId) {
Preconditions.checkNotNull(txnId, "txnId");
return TxnId.newBuilder()
.setHighBits(txnId.getMostSignificantBits())
.setLowBits(txnId.getLeastSignificantBits())
.build();
} | java | public static final TxnId decode(final UUID txnId) {
Preconditions.checkNotNull(txnId, "txnId");
return TxnId.newBuilder()
.setHighBits(txnId.getMostSignificantBits())
.setLowBits(txnId.getLeastSignificantBits())
.build();
} | [
"public",
"static",
"final",
"TxnId",
"decode",
"(",
"final",
"UUID",
"txnId",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"txnId",
",",
"\"txnId\"",
")",
";",
"return",
"TxnId",
".",
"newBuilder",
"(",
")",
".",
"setHighBits",
"(",
"txnId",
".",
... | Returns TxnId object instance for a given transaction with UUID.
@param txnId UUID
@return Instance of TxnId. | [
"Returns",
"TxnId",
"object",
"instance",
"for",
"a",
"given",
"transaction",
"with",
"UUID",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L231-L237 |
132,360 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static final SegmentId decode(final Segment segment) {
Preconditions.checkNotNull(segment, "segment");
return createSegmentId(segment.getScope(), segment.getStreamName(), segment.getSegmentId());
} | java | public static final SegmentId decode(final Segment segment) {
Preconditions.checkNotNull(segment, "segment");
return createSegmentId(segment.getScope(), segment.getStreamName(), segment.getSegmentId());
} | [
"public",
"static",
"final",
"SegmentId",
"decode",
"(",
"final",
"Segment",
"segment",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"segment",
",",
"\"segment\"",
")",
";",
"return",
"createSegmentId",
"(",
"segment",
".",
"getScope",
"(",
")",
",",
... | Decodes segment and returns an instance of SegmentId.
@param segment The segment.
@return Instance of SegmentId. | [
"Decodes",
"segment",
"and",
"returns",
"an",
"instance",
"of",
"SegmentId",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L245-L248 |
132,361 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static final Controller.ScalingPolicy decode(final ScalingPolicy policyModel) {
Preconditions.checkNotNull(policyModel, "policyModel");
return Controller.ScalingPolicy.newBuilder()
.setScaleType(Controller.ScalingPolicy.ScalingPolicyType.valueOf(policyModel.getScaleType().name()))... | java | public static final Controller.ScalingPolicy decode(final ScalingPolicy policyModel) {
Preconditions.checkNotNull(policyModel, "policyModel");
return Controller.ScalingPolicy.newBuilder()
.setScaleType(Controller.ScalingPolicy.ScalingPolicyType.valueOf(policyModel.getScaleType().name()))... | [
"public",
"static",
"final",
"Controller",
".",
"ScalingPolicy",
"decode",
"(",
"final",
"ScalingPolicy",
"policyModel",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"policyModel",
",",
"\"policyModel\"",
")",
";",
"return",
"Controller",
".",
"ScalingPolicy... | Decodes ScalingPolicy and returns an instance of Scaling Policy impl.
@param policyModel The Scaling Policy.
@return Instance of Scaling Policy Impl. | [
"Decodes",
"ScalingPolicy",
"and",
"returns",
"an",
"instance",
"of",
"Scaling",
"Policy",
"impl",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L256-L264 |
132,362 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static final Controller.RetentionPolicy decode(final RetentionPolicy policyModel) {
if (policyModel != null) {
return Controller.RetentionPolicy.newBuilder()
.setRetentionType(Controller.RetentionPolicy.RetentionPolicyType.valueOf(policyModel.getRetentionType().name()))
... | java | public static final Controller.RetentionPolicy decode(final RetentionPolicy policyModel) {
if (policyModel != null) {
return Controller.RetentionPolicy.newBuilder()
.setRetentionType(Controller.RetentionPolicy.RetentionPolicyType.valueOf(policyModel.getRetentionType().name()))
... | [
"public",
"static",
"final",
"Controller",
".",
"RetentionPolicy",
"decode",
"(",
"final",
"RetentionPolicy",
"policyModel",
")",
"{",
"if",
"(",
"policyModel",
"!=",
"null",
")",
"{",
"return",
"Controller",
".",
"RetentionPolicy",
".",
"newBuilder",
"(",
")",
... | Decodes RetentionPolicy and returns an instance of Retention Policy impl.
@param policyModel The Retention Policy.
@return Instance of Retention Policy Impl. | [
"Decodes",
"RetentionPolicy",
"and",
"returns",
"an",
"instance",
"of",
"Retention",
"Policy",
"impl",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L272-L281 |
132,363 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static final StreamConfig decode(String scope, String streamName, final StreamConfiguration configModel) {
Preconditions.checkNotNull(configModel, "configModel");
final StreamConfig.Builder builder = StreamConfig.newBuilder()
.setStreamInfo(createStreamInfo(scope, streamName))
... | java | public static final StreamConfig decode(String scope, String streamName, final StreamConfiguration configModel) {
Preconditions.checkNotNull(configModel, "configModel");
final StreamConfig.Builder builder = StreamConfig.newBuilder()
.setStreamInfo(createStreamInfo(scope, streamName))
... | [
"public",
"static",
"final",
"StreamConfig",
"decode",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"final",
"StreamConfiguration",
"configModel",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"configModel",
",",
"\"configModel\"",
")",
";",
"f... | Converts StreamConfiguration into StreamConfig.
@param scope the stream's scope
@param streamName The Stream Name
@param configModel The stream configuration.
@return StreamConfig instance. | [
"Converts",
"StreamConfiguration",
"into",
"StreamConfig",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L291-L300 |
132,364 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static final NodeUri decode(final PravegaNodeUri uri) {
Preconditions.checkNotNull(uri, "uri");
return NodeUri.newBuilder().setEndpoint(uri.getEndpoint()).setPort(uri.getPort()).build();
} | java | public static final NodeUri decode(final PravegaNodeUri uri) {
Preconditions.checkNotNull(uri, "uri");
return NodeUri.newBuilder().setEndpoint(uri.getEndpoint()).setPort(uri.getPort()).build();
} | [
"public",
"static",
"final",
"NodeUri",
"decode",
"(",
"final",
"PravegaNodeUri",
"uri",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"uri",
",",
"\"uri\"",
")",
";",
"return",
"NodeUri",
".",
"newBuilder",
"(",
")",
".",
"setEndpoint",
"(",
"uri",
... | Converts PravegaNodeURI into NodeURI.
@param uri The PravegaNodeURI string.
@return Node URI string. | [
"Converts",
"PravegaNodeURI",
"into",
"NodeURI",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L308-L311 |
132,365 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.decode | public static Controller.StreamCut decode(final String scope, final String stream, Map<Long, Long> streamCut) {
return Controller.StreamCut.newBuilder().setStreamInfo(createStreamInfo(scope, stream)).putAllCut(streamCut).build();
} | java | public static Controller.StreamCut decode(final String scope, final String stream, Map<Long, Long> streamCut) {
return Controller.StreamCut.newBuilder().setStreamInfo(createStreamInfo(scope, stream)).putAllCut(streamCut).build();
} | [
"public",
"static",
"Controller",
".",
"StreamCut",
"decode",
"(",
"final",
"String",
"scope",
",",
"final",
"String",
"stream",
",",
"Map",
"<",
"Long",
",",
"Long",
">",
"streamCut",
")",
"{",
"return",
"Controller",
".",
"StreamCut",
".",
"newBuilder",
... | Creates a stream cut object.
@param scope scope
@param stream stream
@param streamCut map of segment to position
@return stream cut | [
"Creates",
"a",
"stream",
"cut",
"object",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L321-L323 |
132,366 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.create | static LedgerHandle create(BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(() ->
bookKeeper.createLedger(
config.getBkEnsembleSize(),
config.getB... | java | static LedgerHandle create(BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(() ->
bookKeeper.createLedger(
config.getBkEnsembleSize(),
config.getB... | [
"static",
"LedgerHandle",
"create",
"(",
"BookKeeper",
"bookKeeper",
",",
"BookKeeperConfig",
"config",
")",
"throws",
"DurableDataLogException",
"{",
"try",
"{",
"return",
"Exceptions",
".",
"handleInterruptedCall",
"(",
"(",
")",
"->",
"bookKeeper",
".",
"createLe... | Creates a new Ledger in BookKeeper.
@return A LedgerHandle for the new ledger.
@throws DataLogNotAvailableException If BookKeeper is unavailable or the ledger could not be created because an
insufficient number of Bookies are available. The causing exception is wrapped
inside it.
@throws DurableDataLogException I... | [
"Creates",
"a",
"new",
"Ledger",
"in",
"BookKeeper",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L45-L59 |
132,367 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.openFence | static LedgerHandle openFence(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(
() -> bookKeeper.openLedger(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
} catch (BKExce... | java | static LedgerHandle openFence(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(
() -> bookKeeper.openLedger(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
} catch (BKExce... | [
"static",
"LedgerHandle",
"openFence",
"(",
"long",
"ledgerId",
",",
"BookKeeper",
"bookKeeper",
",",
"BookKeeperConfig",
"config",
")",
"throws",
"DurableDataLogException",
"{",
"try",
"{",
"return",
"Exceptions",
".",
"handleInterruptedCall",
"(",
"(",
")",
"->",
... | Opens a ledger. This operation also fences out the ledger in case anyone else was writing to it.
@param ledgerId The Id of the Ledger to open.
@param bookKeeper A references to the BookKeeper client to use.
@param config Configuration to use.
@return A LedgerHandle for the newly opened ledger.
@throws DurableDat... | [
"Opens",
"a",
"ledger",
".",
"This",
"operation",
"also",
"fences",
"out",
"the",
"ledger",
"in",
"case",
"anyone",
"else",
"was",
"writing",
"to",
"it",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L70-L77 |
132,368 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.openRead | static LedgerHandle openRead(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(
() -> bookKeeper.openLedgerNoRecovery(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
} catc... | java | static LedgerHandle openRead(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(
() -> bookKeeper.openLedgerNoRecovery(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
} catc... | [
"static",
"LedgerHandle",
"openRead",
"(",
"long",
"ledgerId",
",",
"BookKeeper",
"bookKeeper",
",",
"BookKeeperConfig",
"config",
")",
"throws",
"DurableDataLogException",
"{",
"try",
"{",
"return",
"Exceptions",
".",
"handleInterruptedCall",
"(",
"(",
")",
"->",
... | Opens a ledger for reading. This operation does not fence out the ledger.
@param ledgerId The Id of the Ledger to open.
@param bookKeeper A references to the BookKeeper client to use.
@param config Configuration to use.
@return A LedgerHandle for the newly opened ledger.
@throws DurableDataLogException If an exc... | [
"Opens",
"a",
"ledger",
"for",
"reading",
".",
"This",
"operation",
"does",
"not",
"fence",
"out",
"the",
"ledger",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L88-L95 |
132,369 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.close | static void close(LedgerHandle handle) throws DurableDataLogException {
try {
Exceptions.handleInterrupted(handle::close);
} catch (BKException bkEx) {
throw new DurableDataLogException(String.format("Unable to close ledger %d.", handle.getId()), bkEx);
}
} | java | static void close(LedgerHandle handle) throws DurableDataLogException {
try {
Exceptions.handleInterrupted(handle::close);
} catch (BKException bkEx) {
throw new DurableDataLogException(String.format("Unable to close ledger %d.", handle.getId()), bkEx);
}
} | [
"static",
"void",
"close",
"(",
"LedgerHandle",
"handle",
")",
"throws",
"DurableDataLogException",
"{",
"try",
"{",
"Exceptions",
".",
"handleInterrupted",
"(",
"handle",
"::",
"close",
")",
";",
"}",
"catch",
"(",
"BKException",
"bkEx",
")",
"{",
"throw",
... | Closes the given LedgerHandle.
@param handle The LedgerHandle to close.
@throws DurableDataLogException If an exception occurred. The causing exception is wrapped inside it. | [
"Closes",
"the",
"given",
"LedgerHandle",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L128-L134 |
132,370 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.delete | static void delete(long ledgerId, BookKeeper bookKeeper) throws DurableDataLogException {
try {
Exceptions.handleInterrupted(() -> bookKeeper.deleteLedger(ledgerId));
} catch (BKException bkEx) {
throw new DurableDataLogException(String.format("Unable to delete Ledger %d.", ledge... | java | static void delete(long ledgerId, BookKeeper bookKeeper) throws DurableDataLogException {
try {
Exceptions.handleInterrupted(() -> bookKeeper.deleteLedger(ledgerId));
} catch (BKException bkEx) {
throw new DurableDataLogException(String.format("Unable to delete Ledger %d.", ledge... | [
"static",
"void",
"delete",
"(",
"long",
"ledgerId",
",",
"BookKeeper",
"bookKeeper",
")",
"throws",
"DurableDataLogException",
"{",
"try",
"{",
"Exceptions",
".",
"handleInterrupted",
"(",
"(",
")",
"->",
"bookKeeper",
".",
"deleteLedger",
"(",
"ledgerId",
")",... | Deletes the Ledger with given LedgerId.
@param ledgerId The Id of the Ledger to delete.
@param bookKeeper A reference to the BookKeeper client to use.
@throws DurableDataLogException If an exception occurred. The causing exception is wrapped inside it. | [
"Deletes",
"the",
"Ledger",
"with",
"given",
"LedgerId",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L143-L149 |
132,371 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.fenceOut | static Map<Long, Long> fenceOut(List<LedgerMetadata> ledgers, BookKeeper bookKeeper, BookKeeperConfig config, String traceObjectId) throws DurableDataLogException {
// Fence out the ledgers, in descending order. During the process, we need to determine whether the ledgers we
// fenced out actually have ... | java | static Map<Long, Long> fenceOut(List<LedgerMetadata> ledgers, BookKeeper bookKeeper, BookKeeperConfig config, String traceObjectId) throws DurableDataLogException {
// Fence out the ledgers, in descending order. During the process, we need to determine whether the ledgers we
// fenced out actually have ... | [
"static",
"Map",
"<",
"Long",
",",
"Long",
">",
"fenceOut",
"(",
"List",
"<",
"LedgerMetadata",
">",
"ledgers",
",",
"BookKeeper",
"bookKeeper",
",",
"BookKeeperConfig",
"config",
",",
"String",
"traceObjectId",
")",
"throws",
"DurableDataLogException",
"{",
"//... | Fences out a Log made up of the given ledgers.
@param ledgers An ordered list of LedgerMetadata objects representing all the Ledgers in the log.
@param bookKeeper A reference to the BookKeeper client to use.
@param config Configuration to use.
@param traceObjectId Used for logging.
@return A Map of Led... | [
"Fences",
"out",
"a",
"Log",
"made",
"up",
"of",
"the",
"given",
"ledgers",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L162-L189 |
132,372 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/RESTServer.java | RESTServer.startUp | @Override
protected void startUp() {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.objectId, "startUp");
try {
log.info("Starting REST server listening on port: {}", this.restServerConfig.getPort());
if (restServerConfig.isTlsEnabled()) {
SSLCon... | java | @Override
protected void startUp() {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.objectId, "startUp");
try {
log.info("Starting REST server listening on port: {}", this.restServerConfig.getPort());
if (restServerConfig.isTlsEnabled()) {
SSLCon... | [
"@",
"Override",
"protected",
"void",
"startUp",
"(",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnterWithContext",
"(",
"log",
",",
"this",
".",
"objectId",
",",
"\"startUp\"",
")",
";",
"try",
"{",
"log",
".",
"info",
"(",
"\"Starting ... | Start REST service. | [
"Start",
"REST",
"service",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/RESTServer.java#L71-L88 |
132,373 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/RESTServer.java | RESTServer.shutDown | @Override
protected void shutDown() throws Exception {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.objectId, "shutDown");
try {
log.info("Stopping REST server listening on port: {}", this.restServerConfig.getPort());
final GrizzlyFuture<HttpServer> shutdown =... | java | @Override
protected void shutDown() throws Exception {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.objectId, "shutDown");
try {
log.info("Stopping REST server listening on port: {}", this.restServerConfig.getPort());
final GrizzlyFuture<HttpServer> shutdown =... | [
"@",
"Override",
"protected",
"void",
"shutDown",
"(",
")",
"throws",
"Exception",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnterWithContext",
"(",
"log",
",",
"this",
".",
"objectId",
",",
"\"shutDown\"",
")",
";",
"try",
"{",
"log",
".",
... | Gracefully stop REST service. | [
"Gracefully",
"stop",
"REST",
"service",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/RESTServer.java#L93-L105 |
132,374 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/SegmentSelector.java | SegmentSelector.getSegmentOutputStreamForKey | @Synchronized
public SegmentOutputStream getSegmentOutputStreamForKey(String routingKey) {
if (currentSegments == null) {
return null;
}
return writers.get(getSegmentForEvent(routingKey));
} | java | @Synchronized
public SegmentOutputStream getSegmentOutputStreamForKey(String routingKey) {
if (currentSegments == null) {
return null;
}
return writers.get(getSegmentForEvent(routingKey));
} | [
"@",
"Synchronized",
"public",
"SegmentOutputStream",
"getSegmentOutputStreamForKey",
"(",
"String",
"routingKey",
")",
"{",
"if",
"(",
"currentSegments",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"writers",
".",
"get",
"(",
"getSegmentForEvent... | Selects which segment an event should be written to.
@param routingKey The key that should be used to select from the segment that the event
should go to.
@return The SegmentOutputStream for the segment that has been selected or null if
{@link #refreshSegmentEventWriters(Consumer)} needs to be called. | [
"Selects",
"which",
"segment",
"an",
"event",
"should",
"be",
"written",
"to",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/SegmentSelector.java#L64-L70 |
132,375 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/SegmentSelector.java | SegmentSelector.refreshSegmentEventWriters | public List<PendingEvent> refreshSegmentEventWriters(Consumer<Segment> segmentSealedCallBack) {
log.info("Refreshing segments for stream {}", stream);
return updateSegments(Futures.getAndHandleExceptions(
controller.getCurrentSegments(stream.getScope(), stream.getStreamName()), RuntimeEx... | java | public List<PendingEvent> refreshSegmentEventWriters(Consumer<Segment> segmentSealedCallBack) {
log.info("Refreshing segments for stream {}", stream);
return updateSegments(Futures.getAndHandleExceptions(
controller.getCurrentSegments(stream.getScope(), stream.getStreamName()), RuntimeEx... | [
"public",
"List",
"<",
"PendingEvent",
">",
"refreshSegmentEventWriters",
"(",
"Consumer",
"<",
"Segment",
">",
"segmentSealedCallBack",
")",
"{",
"log",
".",
"info",
"(",
"\"Refreshing segments for stream {}\"",
",",
"stream",
")",
";",
"return",
"updateSegments",
... | Refresh the latest list of segments in the given stream.
@param segmentSealedCallBack Method to be executed on receiving SegmentSealed from SSS.
@return A list of events that were sent to old segments and never acked. These should be
re-sent. | [
"Refresh",
"the",
"latest",
"list",
"of",
"segments",
"in",
"the",
"given",
"stream",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/SegmentSelector.java#L109-L114 |
132,376 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/CancellationToken.java | CancellationToken.register | public <T> void register(CompletableFuture<T> future) {
if (future.isDone()) {
// Nothing to do.
return;
}
boolean autoCancel = false;
synchronized (this.futures) {
Preconditions.checkNotNull(future, "future");
if (this.cancellationRequest... | java | public <T> void register(CompletableFuture<T> future) {
if (future.isDone()) {
// Nothing to do.
return;
}
boolean autoCancel = false;
synchronized (this.futures) {
Preconditions.checkNotNull(future, "future");
if (this.cancellationRequest... | [
"public",
"<",
"T",
">",
"void",
"register",
"(",
"CompletableFuture",
"<",
"T",
">",
"future",
")",
"{",
"if",
"(",
"future",
".",
"isDone",
"(",
")",
")",
"{",
"// Nothing to do.",
"return",
";",
"}",
"boolean",
"autoCancel",
"=",
"false",
";",
"sync... | Registers the given Future to the token.
@param future The Future to register.
@param <T> Return type of the future. | [
"Registers",
"the",
"given",
"Future",
"to",
"the",
"token",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/CancellationToken.java#L49-L77 |
132,377 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/CancellationToken.java | CancellationToken.requestCancellation | public void requestCancellation() {
Collection<CompletableFuture<?>> toInvoke;
synchronized (this.futures) {
this.cancellationRequested = true;
toInvoke = new ArrayList<>(this.futures);
}
toInvoke.forEach(f -> f.cancel(true));
synchronized (this.futures) ... | java | public void requestCancellation() {
Collection<CompletableFuture<?>> toInvoke;
synchronized (this.futures) {
this.cancellationRequested = true;
toInvoke = new ArrayList<>(this.futures);
}
toInvoke.forEach(f -> f.cancel(true));
synchronized (this.futures) ... | [
"public",
"void",
"requestCancellation",
"(",
")",
"{",
"Collection",
"<",
"CompletableFuture",
"<",
"?",
">",
">",
"toInvoke",
";",
"synchronized",
"(",
"this",
".",
"futures",
")",
"{",
"this",
".",
"cancellationRequested",
"=",
"true",
";",
"toInvoke",
"=... | Cancels all registered futures. | [
"Cancels",
"all",
"registered",
"futures",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/CancellationToken.java#L82-L93 |
132,378 | pravega/pravega | common/src/main/java/io/pravega/common/tracing/RequestTracker.java | RequestTracker.buildRequestDescriptor | public static String buildRequestDescriptor(String...requestInfo) {
return Stream.of(requestInfo).collect(Collectors.joining(INTER_FIELD_DELIMITER));
} | java | public static String buildRequestDescriptor(String...requestInfo) {
return Stream.of(requestInfo).collect(Collectors.joining(INTER_FIELD_DELIMITER));
} | [
"public",
"static",
"String",
"buildRequestDescriptor",
"(",
"String",
"...",
"requestInfo",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"requestInfo",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"INTER_FIELD_DELIMITER",
")",
")",
";",
"}"
] | Creates a request descriptor or key to locate the client request id.
@param requestInfo Fields to form the request descriptor.
@return Request descriptor. | [
"Creates",
"a",
"request",
"descriptor",
"or",
"key",
"to",
"locate",
"the",
"client",
"request",
"id",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/tracing/RequestTracker.java#L65-L67 |
132,379 | pravega/pravega | common/src/main/java/io/pravega/common/tracing/RequestTracker.java | RequestTracker.trackRequest | public void trackRequest(String requestDescriptor, long requestId) {
Preconditions.checkNotNull(requestDescriptor, "Attempting to track a null request descriptor.");
if (!tracingEnabled) {
return;
}
synchronized (lock) {
List<Long> requestIds = ongoingRequests.ge... | java | public void trackRequest(String requestDescriptor, long requestId) {
Preconditions.checkNotNull(requestDescriptor, "Attempting to track a null request descriptor.");
if (!tracingEnabled) {
return;
}
synchronized (lock) {
List<Long> requestIds = ongoingRequests.ge... | [
"public",
"void",
"trackRequest",
"(",
"String",
"requestDescriptor",
",",
"long",
"requestId",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"requestDescriptor",
",",
"\"Attempting to track a null request descriptor.\"",
")",
";",
"if",
"(",
"!",
"tracingEnabled... | Adds a request descriptor and request id pair in the cache if tracing is enabled. In the case of tracking a
request with an existing descriptor, this method adds the request id to the list associated to the descriptor.
@param requestDescriptor Request descriptor as a single string.
@param requestId Request id associat... | [
"Adds",
"a",
"request",
"descriptor",
"and",
"request",
"id",
"pair",
"in",
"the",
"cache",
"if",
"tracing",
"is",
"enabled",
".",
"In",
"the",
"case",
"of",
"tracking",
"a",
"request",
"with",
"an",
"existing",
"descriptor",
"this",
"method",
"adds",
"the... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/tracing/RequestTracker.java#L154-L171 |
132,380 | pravega/pravega | common/src/main/java/io/pravega/common/tracing/RequestTracker.java | RequestTracker.untrackRequest | public long untrackRequest(String requestDescriptor) {
Preconditions.checkNotNull(requestDescriptor, "Attempting to untrack a null request descriptor.");
if (!tracingEnabled) {
return RequestTag.NON_EXISTENT_ID;
}
long removedRequestId;
List<Long> requestIds;
... | java | public long untrackRequest(String requestDescriptor) {
Preconditions.checkNotNull(requestDescriptor, "Attempting to untrack a null request descriptor.");
if (!tracingEnabled) {
return RequestTag.NON_EXISTENT_ID;
}
long removedRequestId;
List<Long> requestIds;
... | [
"public",
"long",
"untrackRequest",
"(",
"String",
"requestDescriptor",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"requestDescriptor",
",",
"\"Attempting to untrack a null request descriptor.\"",
")",
";",
"if",
"(",
"!",
"tracingEnabled",
")",
"{",
"return",... | Removes and returns a request id from an associated request descriptor. If the request descriptor does not exist
or tracing is disabled, a default request id is returned. In the case that there is only one request id, the
whole entry is evicted from cache. If there are multiple request ids for a given descriptor, the l... | [
"Removes",
"and",
"returns",
"a",
"request",
"id",
"from",
"an",
"associated",
"request",
"descriptor",
".",
"If",
"the",
"request",
"descriptor",
"does",
"not",
"exist",
"or",
"tracing",
"is",
"disabled",
"a",
"default",
"request",
"id",
"is",
"returned",
"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/tracing/RequestTracker.java#L193-L221 |
132,381 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/SegmentAttributeIterator.java | SegmentAttributeIterator.getNext | @Override
public CompletableFuture<List<Map.Entry<UUID, Long>>> getNext() {
return this.indexIterator
.getNext()
.thenApply(this::mix);
} | java | @Override
public CompletableFuture<List<Map.Entry<UUID, Long>>> getNext() {
return this.indexIterator
.getNext()
.thenApply(this::mix);
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"List",
"<",
"Map",
".",
"Entry",
"<",
"UUID",
",",
"Long",
">",
">",
">",
"getNext",
"(",
")",
"{",
"return",
"this",
".",
"indexIterator",
".",
"getNext",
"(",
")",
".",
"thenApply",
"(",
"this",
... | region AttributeIterator Implementation | [
"region",
"AttributeIterator",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/SegmentAttributeIterator.java#L82-L87 |
132,382 | pravega/pravega | client/src/main/java/io/pravega/client/stream/ScalingPolicy.java | ScalingPolicy.fixed | public static ScalingPolicy fixed(int numSegments) {
Preconditions.checkArgument(numSegments > 0, "Number of segments should be > 0.");
return new ScalingPolicy(ScaleType.FIXED_NUM_SEGMENTS, 0, 0, numSegments);
} | java | public static ScalingPolicy fixed(int numSegments) {
Preconditions.checkArgument(numSegments > 0, "Number of segments should be > 0.");
return new ScalingPolicy(ScaleType.FIXED_NUM_SEGMENTS, 0, 0, numSegments);
} | [
"public",
"static",
"ScalingPolicy",
"fixed",
"(",
"int",
"numSegments",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"numSegments",
">",
"0",
",",
"\"Number of segments should be > 0.\"",
")",
";",
"return",
"new",
"ScalingPolicy",
"(",
"ScaleType",
".",
... | Create a scaling policy to configure a stream to have a fixed number of segments.
@param numSegments Fixed number of segments for the stream.
@return Scaling policy object. | [
"Create",
"a",
"scaling",
"policy",
"to",
"configure",
"a",
"stream",
"to",
"have",
"a",
"fixed",
"number",
"of",
"segments",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/ScalingPolicy.java#L62-L65 |
132,383 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java | MemoryStateUpdater.process | void process(Iterator<Operation> operations) throws DataCorruptionException {
HashSet<Long> segmentIds = new HashSet<>();
while (operations.hasNext()) {
Operation op = operations.next();
process(op);
if (op instanceof SegmentOperation) {
// Record rece... | java | void process(Iterator<Operation> operations) throws DataCorruptionException {
HashSet<Long> segmentIds = new HashSet<>();
while (operations.hasNext()) {
Operation op = operations.next();
process(op);
if (op instanceof SegmentOperation) {
// Record rece... | [
"void",
"process",
"(",
"Iterator",
"<",
"Operation",
">",
"operations",
")",
"throws",
"DataCorruptionException",
"{",
"HashSet",
"<",
"Long",
">",
"segmentIds",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"while",
"(",
"operations",
".",
"hasNext",
"(",
... | Processes the given operations and applies them to the ReadIndex and InMemory OperationLog.
@param operations An Iterator iterating over the operations to process (in sequence).
@throws DataCorruptionException If a serious, non-recoverable, data corruption was detected, such as trying to
append operations out of order... | [
"Processes",
"the",
"given",
"operations",
"and",
"applies",
"them",
"to",
"the",
"ReadIndex",
"and",
"InMemory",
"OperationLog",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java#L102-L122 |
132,384 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java | MemoryStateUpdater.process | void process(Operation operation) throws DataCorruptionException {
// Add entry to MemoryTransactionLog and ReadIndex/Cache. This callback is invoked from the OperationProcessor,
// which always acks items in order of Sequence Number - so the entries should be ordered (but always check).
if (ope... | java | void process(Operation operation) throws DataCorruptionException {
// Add entry to MemoryTransactionLog and ReadIndex/Cache. This callback is invoked from the OperationProcessor,
// which always acks items in order of Sequence Number - so the entries should be ordered (but always check).
if (ope... | [
"void",
"process",
"(",
"Operation",
"operation",
")",
"throws",
"DataCorruptionException",
"{",
"// Add entry to MemoryTransactionLog and ReadIndex/Cache. This callback is invoked from the OperationProcessor,",
"// which always acks items in order of Sequence Number - so the entries should be o... | Processes the given operation and applies it to the ReadIndex and InMemory OperationLog.
@param operation The operation to process.
@throws DataCorruptionException If a serious, non-recoverable, data corruption was detected, such as trying to
append operations out of order. | [
"Processes",
"the",
"given",
"operation",
"and",
"applies",
"it",
"to",
"the",
"ReadIndex",
"and",
"InMemory",
"OperationLog",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java#L131-L158 |
132,385 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java | MemoryStateUpdater.addToReadIndex | private void addToReadIndex(StorageOperation operation) {
try {
if (operation instanceof StreamSegmentAppendOperation) {
// Record a StreamSegmentAppendOperation. Just in case, we also support this type of operation, but we need to
// log a warning indicating so. This... | java | private void addToReadIndex(StorageOperation operation) {
try {
if (operation instanceof StreamSegmentAppendOperation) {
// Record a StreamSegmentAppendOperation. Just in case, we also support this type of operation, but we need to
// log a warning indicating so. This... | [
"private",
"void",
"addToReadIndex",
"(",
"StorageOperation",
"operation",
")",
"{",
"try",
"{",
"if",
"(",
"operation",
"instanceof",
"StreamSegmentAppendOperation",
")",
"{",
"// Record a StreamSegmentAppendOperation. Just in case, we also support this type of operation, but we n... | Registers the given operation in the ReadIndex.
@param operation The operation to register. | [
"Registers",
"the",
"given",
"operation",
"in",
"the",
"ReadIndex",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java#L165-L190 |
132,386 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/MultiKeySequentialProcessor.java | MultiKeySequentialProcessor.add | public <ReturnType> CompletableFuture<ReturnType> add(Collection<KeyType> keys, Supplier<CompletableFuture<? extends ReturnType>> toRun) {
Preconditions.checkArgument(!keys.isEmpty(), "keys cannot be empty.");
CompletableFuture<ReturnType> result = new CompletableFuture<>();
ArrayList<Completabl... | java | public <ReturnType> CompletableFuture<ReturnType> add(Collection<KeyType> keys, Supplier<CompletableFuture<? extends ReturnType>> toRun) {
Preconditions.checkArgument(!keys.isEmpty(), "keys cannot be empty.");
CompletableFuture<ReturnType> result = new CompletableFuture<>();
ArrayList<Completabl... | [
"public",
"<",
"ReturnType",
">",
"CompletableFuture",
"<",
"ReturnType",
">",
"add",
"(",
"Collection",
"<",
"KeyType",
">",
"keys",
",",
"Supplier",
"<",
"CompletableFuture",
"<",
"?",
"extends",
"ReturnType",
">",
">",
"toRun",
")",
"{",
"Preconditions",
... | Queues up a new task to execute, subject to the given dependency Keys.
This task will not begin execution until all previous tasks for the given dependency Keys have finished.
In addition, no subsequent task for any of the given dependency Keys will begin executing until this task has
finished executing.
@param keys ... | [
"Queues",
"up",
"a",
"new",
"task",
"to",
"execute",
"subject",
"to",
"the",
"given",
"dependency",
"Keys",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/MultiKeySequentialProcessor.java#L97-L130 |
132,387 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/MultiKeySequentialProcessor.java | MultiKeySequentialProcessor.addWithFilter | public <ReturnType> CompletableFuture<ReturnType> addWithFilter(Predicate<KeyType> keyFilter, Supplier<CompletableFuture<? extends ReturnType>> toRun) {
CompletableFuture<ReturnType> result = new CompletableFuture<>();
ArrayList<CompletableFuture<?>> existingTasks = new ArrayList<>();
synchroniz... | java | public <ReturnType> CompletableFuture<ReturnType> addWithFilter(Predicate<KeyType> keyFilter, Supplier<CompletableFuture<? extends ReturnType>> toRun) {
CompletableFuture<ReturnType> result = new CompletableFuture<>();
ArrayList<CompletableFuture<?>> existingTasks = new ArrayList<>();
synchroniz... | [
"public",
"<",
"ReturnType",
">",
"CompletableFuture",
"<",
"ReturnType",
">",
"addWithFilter",
"(",
"Predicate",
"<",
"KeyType",
">",
"keyFilter",
",",
"Supplier",
"<",
"CompletableFuture",
"<",
"?",
"extends",
"ReturnType",
">",
">",
"toRun",
")",
"{",
"Comp... | Queues up a new task to execute, subject to the dependency keys that match the given filter.
This task will not begin execution until all previous tasks whose keys match the given filter have finished.
In addition, no subsequent task for any key that matches the given filter will begin executing until this task has
fi... | [
"Queues",
"up",
"a",
"new",
"task",
"to",
"execute",
"subject",
"to",
"the",
"dependency",
"keys",
"that",
"match",
"the",
"given",
"filter",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/MultiKeySequentialProcessor.java#L146-L169 |
132,388 | pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/records/StreamSegmentRecord.java | StreamSegmentRecord.overlaps | public static boolean overlaps(final Map.Entry<Double, Double> first,
final Map.Entry<Double, Double> second) {
return second.getValue() > first.getKey() && second.getKey() < first.getValue();
} | java | public static boolean overlaps(final Map.Entry<Double, Double> first,
final Map.Entry<Double, Double> second) {
return second.getValue() > first.getKey() && second.getKey() < first.getValue();
} | [
"public",
"static",
"boolean",
"overlaps",
"(",
"final",
"Map",
".",
"Entry",
"<",
"Double",
",",
"Double",
">",
"first",
",",
"final",
"Map",
".",
"Entry",
"<",
"Double",
",",
"Double",
">",
"second",
")",
"{",
"return",
"second",
".",
"getValue",
"("... | Method to check if two segment overlaps.
@param first first segment
@param second second segment
@return true if they overlap, false otherwise | [
"Method",
"to",
"check",
"if",
"two",
"segment",
"overlaps",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/records/StreamSegmentRecord.java#L73-L76 |
132,389 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableIterator.java | TableIterator.getNext | @Override
public CompletableFuture<T> getNext() {
// Verify no other call to getNext() is currently executing.
return getNextBucket()
.thenCompose(bucket -> {
if (bucket == null) {
// We are done.
return CompletableF... | java | @Override
public CompletableFuture<T> getNext() {
// Verify no other call to getNext() is currently executing.
return getNextBucket()
.thenCompose(bucket -> {
if (bucket == null) {
// We are done.
return CompletableF... | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"T",
">",
"getNext",
"(",
")",
"{",
"// Verify no other call to getNext() is currently executing.",
"return",
"getNextBucket",
"(",
")",
".",
"thenCompose",
"(",
"bucket",
"->",
"{",
"if",
"(",
"bucket",
"==",
"... | region AsyncIterator Implementation | [
"region",
"AsyncIterator",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableIterator.java#L61-L74 |
132,390 | pravega/pravega | common/src/main/java/io/pravega/common/io/serialization/RevisionDataOutputStream.java | RevisionDataOutputStream.wrap | public static RevisionDataOutputStream wrap(OutputStream outputStream) throws IOException {
if (outputStream instanceof RandomAccessOutputStream) {
return new RandomRevisionDataOutput(outputStream);
} else {
return new NonSeekableRevisionDataOutput(outputStream);
}
} | java | public static RevisionDataOutputStream wrap(OutputStream outputStream) throws IOException {
if (outputStream instanceof RandomAccessOutputStream) {
return new RandomRevisionDataOutput(outputStream);
} else {
return new NonSeekableRevisionDataOutput(outputStream);
}
} | [
"public",
"static",
"RevisionDataOutputStream",
"wrap",
"(",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"outputStream",
"instanceof",
"RandomAccessOutputStream",
")",
"{",
"return",
"new",
"RandomRevisionDataOutput",
"(",
"outputStream",... | Wraps the given OutputStream into a specific implementation of RevisionDataOutputStream.
@param outputStream The OutputStream to wrap.
@return A new instance of a RevisionDataOutputStream sub-class, depending on whether the given OutputStream is a
RandomAccessOutputStream (supports seeking) or not.
@throws IOException... | [
"Wraps",
"the",
"given",
"OutputStream",
"into",
"a",
"specific",
"implementation",
"of",
"RevisionDataOutputStream",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/io/serialization/RevisionDataOutputStream.java#L44-L50 |
132,391 | pravega/pravega | common/src/main/java/io/pravega/common/io/serialization/RevisionDataOutputStream.java | RevisionDataOutputStream.getUTFLength | @Override
public int getUTFLength(String s) {
// This code is extracted out of DataOutputStream.writeUTF(). If we change the underlying implementation, this
// needs to change as well.
int charCount = s.length();
int length = 2; // writeUTF() will also encode a 2-byte length.
... | java | @Override
public int getUTFLength(String s) {
// This code is extracted out of DataOutputStream.writeUTF(). If we change the underlying implementation, this
// needs to change as well.
int charCount = s.length();
int length = 2; // writeUTF() will also encode a 2-byte length.
... | [
"@",
"Override",
"public",
"int",
"getUTFLength",
"(",
"String",
"s",
")",
"{",
"// This code is extracted out of DataOutputStream.writeUTF(). If we change the underlying implementation, this",
"// needs to change as well.",
"int",
"charCount",
"=",
"s",
".",
"length",
"(",
")"... | region RevisionDataOutput Implementation | [
"region",
"RevisionDataOutput",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/io/serialization/RevisionDataOutputStream.java#L56-L73 |
132,392 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java | SegmentKeyCache.get | CacheBucketOffset get(UUID keyHash, int generation) {
CacheEntry entry;
synchronized (this) {
// First, check the tail cache.
CacheBucketOffset tailOffset = this.tailOffsets.get(keyHash);
if (tailOffset != null) {
return tailOffset;
}
... | java | CacheBucketOffset get(UUID keyHash, int generation) {
CacheEntry entry;
synchronized (this) {
// First, check the tail cache.
CacheBucketOffset tailOffset = this.tailOffsets.get(keyHash);
if (tailOffset != null) {
return tailOffset;
}
... | [
"CacheBucketOffset",
"get",
"(",
"UUID",
"keyHash",
",",
"int",
"generation",
")",
"{",
"CacheEntry",
"entry",
";",
"synchronized",
"(",
"this",
")",
"{",
"// First, check the tail cache.",
"CacheBucketOffset",
"tailOffset",
"=",
"this",
".",
"tailOffsets",
".",
"... | Looks up a cached offset for the given Key Hash.
@param keyHash A UUID representing the Key Hash to look up.
@return A {@link CacheBucketOffset} representing the sought result. | [
"Looks",
"up",
"a",
"cached",
"offset",
"for",
"the",
"given",
"Key",
"Hash",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java#L211-L232 |
132,393 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrameReader.java | DataFrameReader.getNext | @Override
public DataFrameRecord<T> getNext() throws DataCorruptionException, DurableDataLogException {
Exceptions.checkNotClosed(this.closed, closed);
try {
while (!this.dataFrameInputStream.isClosed()) {
try {
if (!this.dataFrameInputStream.beginRec... | java | @Override
public DataFrameRecord<T> getNext() throws DataCorruptionException, DurableDataLogException {
Exceptions.checkNotClosed(this.closed, closed);
try {
while (!this.dataFrameInputStream.isClosed()) {
try {
if (!this.dataFrameInputStream.beginRec... | [
"@",
"Override",
"public",
"DataFrameRecord",
"<",
"T",
">",
"getNext",
"(",
")",
"throws",
"DataCorruptionException",
",",
"DurableDataLogException",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"this",
".",
"closed",
",",
"closed",
")",
";",
"try",
"{",
"w... | Attempts to return the next Operation from the DataFrameLog.
@return A DataFrameRecord with the requested operation. If no more Operations are available, null is returned. | [
"Attempts",
"to",
"return",
"the",
"next",
"Operation",
"from",
"the",
"DataFrameLog",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DataFrameReader.java#L79-L126 |
132,394 | square/javapoet | src/main/java/com/squareup/javapoet/CodeWriter.java | CodeWriter.emitTypeVariables | public void emitTypeVariables(List<TypeVariableName> typeVariables) throws IOException {
if (typeVariables.isEmpty()) return;
typeVariables.forEach(typeVariable -> currentTypeVariables.add(typeVariable.name));
emit("<");
boolean firstTypeVariable = true;
for (TypeVariableName typeVariable : typeVa... | java | public void emitTypeVariables(List<TypeVariableName> typeVariables) throws IOException {
if (typeVariables.isEmpty()) return;
typeVariables.forEach(typeVariable -> currentTypeVariables.add(typeVariable.name));
emit("<");
boolean firstTypeVariable = true;
for (TypeVariableName typeVariable : typeVa... | [
"public",
"void",
"emitTypeVariables",
"(",
"List",
"<",
"TypeVariableName",
">",
"typeVariables",
")",
"throws",
"IOException",
"{",
"if",
"(",
"typeVariables",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"typeVariables",
".",
"forEach",
"(",
"typeVariable",
... | Emit type variables with their bounds. This should only be used when declaring type variables;
everywhere else bounds are omitted. | [
"Emit",
"type",
"variables",
"with",
"their",
"bounds",
".",
"This",
"should",
"only",
"be",
"used",
"when",
"declaring",
"type",
"variables",
";",
"everywhere",
"else",
"bounds",
"are",
"omitted",
"."
] | 0f93da9a3d9a1da8d29fc993409fcf83d40452bc | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/CodeWriter.java#L188-L207 |
132,395 | square/javapoet | src/main/java/com/squareup/javapoet/CodeWriter.java | CodeWriter.suggestedImports | Map<String, ClassName> suggestedImports() {
Map<String, ClassName> result = new LinkedHashMap<>(importableTypes);
result.keySet().removeAll(referencedNames);
return result;
} | java | Map<String, ClassName> suggestedImports() {
Map<String, ClassName> result = new LinkedHashMap<>(importableTypes);
result.keySet().removeAll(referencedNames);
return result;
} | [
"Map",
"<",
"String",
",",
"ClassName",
">",
"suggestedImports",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"ClassName",
">",
"result",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"importableTypes",
")",
";",
"result",
".",
"keySet",
"(",
")",
".",
"removeAll... | Returns the types that should have been imported for this code. If there were any simple name
collisions, that type's first use is imported. | [
"Returns",
"the",
"types",
"that",
"should",
"have",
"been",
"imported",
"for",
"this",
"code",
".",
"If",
"there",
"were",
"any",
"simple",
"name",
"collisions",
"that",
"type",
"s",
"first",
"use",
"is",
"imported",
"."
] | 0f93da9a3d9a1da8d29fc993409fcf83d40452bc | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/CodeWriter.java#L503-L507 |
132,396 | square/javapoet | src/main/java/com/squareup/javapoet/ClassName.java | ClassName.reflectionName | public String reflectionName() {
return enclosingClassName != null
? (enclosingClassName.reflectionName() + '$' + simpleName)
: (packageName.isEmpty() ? simpleName : packageName + '.' + simpleName);
} | java | public String reflectionName() {
return enclosingClassName != null
? (enclosingClassName.reflectionName() + '$' + simpleName)
: (packageName.isEmpty() ? simpleName : packageName + '.' + simpleName);
} | [
"public",
"String",
"reflectionName",
"(",
")",
"{",
"return",
"enclosingClassName",
"!=",
"null",
"?",
"(",
"enclosingClassName",
".",
"reflectionName",
"(",
")",
"+",
"'",
"'",
"+",
"simpleName",
")",
":",
"(",
"packageName",
".",
"isEmpty",
"(",
")",
"?... | Return the binary name of a class. | [
"Return",
"the",
"binary",
"name",
"of",
"a",
"class",
"."
] | 0f93da9a3d9a1da8d29fc993409fcf83d40452bc | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ClassName.java#L106-L110 |
132,397 | square/javapoet | src/main/java/com/squareup/javapoet/ClassName.java | ClassName.enclosingClasses | private List<ClassName> enclosingClasses() {
List<ClassName> result = new ArrayList<>();
for (ClassName c = this; c != null; c = c.enclosingClassName) {
result.add(c);
}
Collections.reverse(result);
return result;
} | java | private List<ClassName> enclosingClasses() {
List<ClassName> result = new ArrayList<>();
for (ClassName c = this; c != null; c = c.enclosingClassName) {
result.add(c);
}
Collections.reverse(result);
return result;
} | [
"private",
"List",
"<",
"ClassName",
">",
"enclosingClasses",
"(",
")",
"{",
"List",
"<",
"ClassName",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ClassName",
"c",
"=",
"this",
";",
"c",
"!=",
"null",
";",
"c",
"=",
"c... | Returns all enclosing classes in this, outermost first. | [
"Returns",
"all",
"enclosing",
"classes",
"in",
"this",
"outermost",
"first",
"."
] | 0f93da9a3d9a1da8d29fc993409fcf83d40452bc | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ClassName.java#L289-L296 |
132,398 | square/javapoet | src/main/java/com/squareup/javapoet/LineWrapper.java | LineWrapper.wrappingSpace | void wrappingSpace(int indentLevel) throws IOException {
if (closed) throw new IllegalStateException("closed");
if (this.nextFlush != null) flush(nextFlush);
column++; // Increment the column even though the space is deferred to next call to flush().
this.nextFlush = FlushType.SPACE;
this.indentLev... | java | void wrappingSpace(int indentLevel) throws IOException {
if (closed) throw new IllegalStateException("closed");
if (this.nextFlush != null) flush(nextFlush);
column++; // Increment the column even though the space is deferred to next call to flush().
this.nextFlush = FlushType.SPACE;
this.indentLev... | [
"void",
"wrappingSpace",
"(",
"int",
"indentLevel",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"closed\"",
")",
";",
"if",
"(",
"this",
".",
"nextFlush",
"!=",
"null",
")",
"flush",
"(",
"ne... | Emit either a space or a newline character. | [
"Emit",
"either",
"a",
"space",
"or",
"a",
"newline",
"character",
"."
] | 0f93da9a3d9a1da8d29fc993409fcf83d40452bc | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/LineWrapper.java#L83-L90 |
132,399 | square/javapoet | src/main/java/com/squareup/javapoet/LineWrapper.java | LineWrapper.zeroWidthSpace | void zeroWidthSpace(int indentLevel) throws IOException {
if (closed) throw new IllegalStateException("closed");
if (column == 0) return;
if (this.nextFlush != null) flush(nextFlush);
this.nextFlush = FlushType.EMPTY;
this.indentLevel = indentLevel;
} | java | void zeroWidthSpace(int indentLevel) throws IOException {
if (closed) throw new IllegalStateException("closed");
if (column == 0) return;
if (this.nextFlush != null) flush(nextFlush);
this.nextFlush = FlushType.EMPTY;
this.indentLevel = indentLevel;
} | [
"void",
"zeroWidthSpace",
"(",
"int",
"indentLevel",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"closed\"",
")",
";",
"if",
"(",
"column",
"==",
"0",
")",
"return",
";",
"if",
"(",
"this",
... | Emit a newline character if the line will exceed it's limit, otherwise do nothing. | [
"Emit",
"a",
"newline",
"character",
"if",
"the",
"line",
"will",
"exceed",
"it",
"s",
"limit",
"otherwise",
"do",
"nothing",
"."
] | 0f93da9a3d9a1da8d29fc993409fcf83d40452bc | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/LineWrapper.java#L93-L100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.