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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
131,800 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyIndex.java | ContainerKeyIndex.validateConditionalUpdate | private CompletableFuture<Void> validateConditionalUpdate(DirectSegmentAccess segment, TableKeyBatch batch, TimeoutTimer timer) {
Exceptions.checkNotClosed(this.closed.get(), this);
List<UUID> hashes = batch.getVersionedItems().stream()
.map(TableKeyBatch.Item::getHash)
.... | java | private CompletableFuture<Void> validateConditionalUpdate(DirectSegmentAccess segment, TableKeyBatch batch, TimeoutTimer timer) {
Exceptions.checkNotClosed(this.closed.get(), this);
List<UUID> hashes = batch.getVersionedItems().stream()
.map(TableKeyBatch.Item::getHash)
.... | [
"private",
"CompletableFuture",
"<",
"Void",
">",
"validateConditionalUpdate",
"(",
"DirectSegmentAccess",
"segment",
",",
"TableKeyBatch",
"batch",
",",
"TimeoutTimer",
"timer",
")",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"this",
".",
"closed",
".",
"get",
... | Validates all the conditional updates specified in the given TableKeyBatch.
@param segment The Segment to operate on.
@param batch The TableKeyBatch to validate.
@param timer Timer for the operation.
@return A CompletableFuture that, when completed, will indicate that validation succeeded. If the validation did
no... | [
"Validates",
"all",
"the",
"conditional",
"updates",
"specified",
"in",
"the",
"given",
"TableKeyBatch",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyIndex.java#L396-L414 |
131,801 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyIndex.java | ContainerKeyIndex.validateConditionalUpdate | @SneakyThrows(ConditionalTableUpdateException.class)
private void validateConditionalUpdate(List<TableKeyBatch.Item> items, Map<UUID, Long> bucketOffsets, String segmentName) {
val badKeyVersions = new HashMap<TableKey, Long>(); // Key = Key that failed, Value = Key's bucket offset.
for (val item : ... | java | @SneakyThrows(ConditionalTableUpdateException.class)
private void validateConditionalUpdate(List<TableKeyBatch.Item> items, Map<UUID, Long> bucketOffsets, String segmentName) {
val badKeyVersions = new HashMap<TableKey, Long>(); // Key = Key that failed, Value = Key's bucket offset.
for (val item : ... | [
"@",
"SneakyThrows",
"(",
"ConditionalTableUpdateException",
".",
"class",
")",
"private",
"void",
"validateConditionalUpdate",
"(",
"List",
"<",
"TableKeyBatch",
".",
"Item",
">",
"items",
",",
"Map",
"<",
"UUID",
",",
"Long",
">",
"bucketOffsets",
",",
"String... | Validates a list of UpdateBatchItems against their actual Table Bucket offsets.
@param items A list of {@link TableKeyBatch.Item} instances to validate.
@param bucketOffsets A Map of Key Hashes to their corresponding offsets (versions). Each {@link TableKeyBatch.Item}
will be looked up in this Map (based on th... | [
"Validates",
"a",
"list",
"of",
"UpdateBatchItems",
"against",
"their",
"actual",
"Table",
"Bucket",
"offsets",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyIndex.java#L428-L453 |
131,802 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/AckCalculator.java | AckCalculator.getHighestCommittedSequenceNumber | <T extends WriterSegmentProcessor> long getHighestCommittedSequenceNumber(Iterable<T> processors) {
long lowestUncommittedSeqNo = Long.MAX_VALUE;
for (WriterSegmentProcessor a : processors) {
if (!a.isClosed()) {
long firstSeqNo = a.getLowestUncommittedSequenceNumber();
... | java | <T extends WriterSegmentProcessor> long getHighestCommittedSequenceNumber(Iterable<T> processors) {
long lowestUncommittedSeqNo = Long.MAX_VALUE;
for (WriterSegmentProcessor a : processors) {
if (!a.isClosed()) {
long firstSeqNo = a.getLowestUncommittedSequenceNumber();
... | [
"<",
"T",
"extends",
"WriterSegmentProcessor",
">",
"long",
"getHighestCommittedSequenceNumber",
"(",
"Iterable",
"<",
"T",
">",
"processors",
")",
"{",
"long",
"lowestUncommittedSeqNo",
"=",
"Long",
".",
"MAX_VALUE",
";",
"for",
"(",
"WriterSegmentProcessor",
"a",
... | Determines the largest Sequence Number that can be safely truncated from the Writer's Data Source. All operations
up to, and including the one for this Sequence Number have been successfully committed to External Storage.
The Sequence Number we acknowledge has the property that all operations up to, and including it, ... | [
"Determines",
"the",
"largest",
"Sequence",
"Number",
"that",
"can",
"be",
"safely",
"truncated",
"from",
"the",
"Writer",
"s",
"Data",
"Source",
".",
"All",
"operations",
"up",
"to",
"and",
"including",
"the",
"one",
"for",
"this",
"Sequence",
"Number",
"ha... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/AckCalculator.java#L57-L72 |
131,803 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/ZKSegmentContainerMonitor.java | ZKSegmentContainerMonitor.checkAssignment | @Synchronized
private void checkAssignment() {
long traceId = LoggerHelpers.traceEnter(log, "checkAssignment");
try {
Exceptions.checkNotClosed(closed.get(), this);
// Fetch the list of containers that is supposed to be owned by this host.
Set<Integer> desiredLis... | java | @Synchronized
private void checkAssignment() {
long traceId = LoggerHelpers.traceEnter(log, "checkAssignment");
try {
Exceptions.checkNotClosed(closed.get(), this);
// Fetch the list of containers that is supposed to be owned by this host.
Set<Integer> desiredLis... | [
"@",
"Synchronized",
"private",
"void",
"checkAssignment",
"(",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnter",
"(",
"log",
",",
"\"checkAssignment\"",
")",
";",
"try",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"closed",
".",
"get",
... | The container assignment monitor.
This method will fetch the current owned containers for this host and ensures that the local containers' state
reflects this. | [
"The",
"container",
"assignment",
"monitor",
".",
"This",
"method",
"will",
"fetch",
"the",
"current",
"owned",
"containers",
"for",
"this",
"host",
"and",
"ensures",
"that",
"the",
"local",
"containers",
"state",
"reflects",
"this",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/ZKSegmentContainerMonitor.java#L158-L194 |
131,804 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/ZKSegmentContainerMonitor.java | ZKSegmentContainerMonitor.stopContainer | private CompletableFuture<Void> stopContainer(int containerId) {
log.info("Stopping Container {}.", containerId);
ContainerHandle handle = handles.get(containerId);
if (handle == null) {
log.warn("Container {} handle is null, container is pending start or already unregistered.", cont... | java | private CompletableFuture<Void> stopContainer(int containerId) {
log.info("Stopping Container {}.", containerId);
ContainerHandle handle = handles.get(containerId);
if (handle == null) {
log.warn("Container {} handle is null, container is pending start or already unregistered.", cont... | [
"private",
"CompletableFuture",
"<",
"Void",
">",
"stopContainer",
"(",
"int",
"containerId",
")",
"{",
"log",
".",
"info",
"(",
"\"Stopping Container {}.\"",
",",
"containerId",
")",
";",
"ContainerHandle",
"handle",
"=",
"handles",
".",
"get",
"(",
"containerI... | Stop the container given its id. | [
"Stop",
"the",
"container",
"given",
"its",
"id",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/ZKSegmentContainerMonitor.java#L197-L229 |
131,805 | pravega/pravega | common/src/main/java/io/pravega/common/util/Property.java | Property.named | public static <T> Property<T> named(String name, T defaultValue) {
return new Property<>(name, defaultValue);
} | java | public static <T> Property<T> named(String name, T defaultValue) {
return new Property<>(name, defaultValue);
} | [
"public",
"static",
"<",
"T",
">",
"Property",
"<",
"T",
">",
"named",
"(",
"String",
"name",
",",
"T",
"defaultValue",
")",
"{",
"return",
"new",
"Property",
"<>",
"(",
"name",
",",
"defaultValue",
")",
";",
"}"
] | Creates a new instance of the Property class with the given default value.
@param name The name of the property.
@param defaultValue The default value of the property.
@param <T> The type of the property values.
@return A new instance of the Property class with the given default value. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"Property",
"class",
"with",
"the",
"given",
"default",
"value",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/Property.java#L47-L49 |
131,806 | pravega/pravega | standalone/src/main/java/io/pravega/local/InProcPravegaCluster.java | InProcPravegaCluster.start | @Synchronized
public void start() throws Exception {
/*Start the ZK*/
if (isInProcZK) {
zkUrl = "localhost:" + zkPort;
startLocalZK();
} else {
URI zkUri = new URI("temp://" + zkUrl);
zkHost = zkUri.getHost();
zkPort = zkUri.getPor... | java | @Synchronized
public void start() throws Exception {
/*Start the ZK*/
if (isInProcZK) {
zkUrl = "localhost:" + zkPort;
startLocalZK();
} else {
URI zkUri = new URI("temp://" + zkUrl);
zkHost = zkUri.getHost();
zkPort = zkUri.getPor... | [
"@",
"Synchronized",
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"/*Start the ZK*/",
"if",
"(",
"isInProcZK",
")",
"{",
"zkUrl",
"=",
"\"localhost:\"",
"+",
"zkPort",
";",
"startLocalZK",
"(",
")",
";",
"}",
"else",
"{",
"URI",
"zkUri"... | Kicks off the cluster creation. right now it can be done only once in lifetime of a process.
@throws Exception Exception thrown by ZK/HDFS etc. | [
"Kicks",
"off",
"the",
"cluster",
"creation",
".",
"right",
"now",
"it",
"can",
"be",
"done",
"only",
"once",
"in",
"lifetime",
"of",
"a",
"process",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/standalone/src/main/java/io/pravega/local/InProcPravegaCluster.java#L176-L205 |
131,807 | pravega/pravega | standalone/src/main/java/io/pravega/local/InProcPravegaCluster.java | InProcPravegaCluster.startLocalSegmentStore | private void startLocalSegmentStore(int segmentStoreId) throws Exception {
Properties authProps = new Properties();
authProps.setProperty("pravega.client.auth.method", "Default");
authProps.setProperty("pravega.client.auth.userName", "arvind");
authProps.setProperty("pravega.client.auth.... | java | private void startLocalSegmentStore(int segmentStoreId) throws Exception {
Properties authProps = new Properties();
authProps.setProperty("pravega.client.auth.method", "Default");
authProps.setProperty("pravega.client.auth.userName", "arvind");
authProps.setProperty("pravega.client.auth.... | [
"private",
"void",
"startLocalSegmentStore",
"(",
"int",
"segmentStoreId",
")",
"throws",
"Exception",
"{",
"Properties",
"authProps",
"=",
"new",
"Properties",
"(",
")",
";",
"authProps",
".",
"setProperty",
"(",
"\"pravega.client.auth.method\"",
",",
"\"Default\"",
... | Starts a SegmentStore with the given id. This is re-entrant. Eventually this will allow starting and stopping of
individual SegmentStore instances. This is not possible right now.
@param segmentStoreId id of the SegmentStore. | [
"Starts",
"a",
"SegmentStore",
"with",
"the",
"given",
"id",
".",
"This",
"is",
"re",
"-",
"entrant",
".",
"Eventually",
"this",
"will",
"allow",
"starting",
"and",
"stopping",
"of",
"individual",
"SegmentStore",
"instances",
".",
"This",
"is",
"not",
"possi... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/standalone/src/main/java/io/pravega/local/InProcPravegaCluster.java#L258-L305 |
131,808 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java | OperationMetadataUpdater.commit | int commit(long upToTransactionId) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "commit", upToTransactionId);
// Commit every UpdateTransaction, in order, until we reach our transaction id.
List<Long> commits = new ArrayList<>();
while (!this.transaction... | java | int commit(long upToTransactionId) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "commit", upToTransactionId);
// Commit every UpdateTransaction, in order, until we reach our transaction id.
List<Long> commits = new ArrayList<>();
while (!this.transaction... | [
"int",
"commit",
"(",
"long",
"upToTransactionId",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnterWithContext",
"(",
"log",
",",
"this",
".",
"traceObjectId",
",",
"\"commit\"",
",",
"upToTransactionId",
")",
";",
"// Commit every UpdateTransacti... | Commits all outstanding changes to the base Container Metadata, up to and including the one for the given
UpdateTransaction.
@param upToTransactionId The Id of the UpdateTransaction up to which to commit.
@return The number of MetadataUpdateTransactions committed. | [
"Commits",
"all",
"outstanding",
"changes",
"to",
"the",
"base",
"Container",
"Metadata",
"up",
"to",
"and",
"including",
"the",
"one",
"for",
"the",
"given",
"UpdateTransaction",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java#L143-L163 |
131,809 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java | OperationMetadataUpdater.rollback | void rollback(long fromTransactionId) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "rollback", fromTransactionId);
List<Long> rolledBack = new ArrayList<>();
while (!this.transactions.isEmpty() && this.transactions.peekLast().getTransactionId() >= fromTransaction... | java | void rollback(long fromTransactionId) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "rollback", fromTransactionId);
List<Long> rolledBack = new ArrayList<>();
while (!this.transactions.isEmpty() && this.transactions.peekLast().getTransactionId() >= fromTransaction... | [
"void",
"rollback",
"(",
"long",
"fromTransactionId",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnterWithContext",
"(",
"log",
",",
"this",
".",
"traceObjectId",
",",
"\"rollback\"",
",",
"fromTransactionId",
")",
";",
"List",
"<",
"Long",
... | Discards any outstanding changes, starting at the given UpdateTransaction forward.
@param fromTransactionId The Id of the UpdateTransaction from which to rollback. | [
"Discards",
"any",
"outstanding",
"changes",
"starting",
"at",
"the",
"given",
"UpdateTransaction",
"forward",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java#L170-L182 |
131,810 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java | OperationProcessor.process | public CompletableFuture<Void> process(Operation operation) {
CompletableFuture<Void> result = new CompletableFuture<>();
if (!isRunning()) {
result.completeExceptionally(new IllegalContainerStateException("OperationProcessor is not running."));
} else {
log.debug("{}: pr... | java | public CompletableFuture<Void> process(Operation operation) {
CompletableFuture<Void> result = new CompletableFuture<>();
if (!isRunning()) {
result.completeExceptionally(new IllegalContainerStateException("OperationProcessor is not running."));
} else {
log.debug("{}: pr... | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"process",
"(",
"Operation",
"operation",
")",
"{",
"CompletableFuture",
"<",
"Void",
">",
"result",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"isRunning",
"(",
")",
")",
"{",
"... | Processes the given Operation. This method returns when the given Operation has been added to the internal queue.
@param operation The Operation to process.
@return A CompletableFuture that, when completed, will indicate the Operation has finished processing. If the
Operation completed successfully, the Future will co... | [
"Processes",
"the",
"given",
"Operation",
".",
"This",
"method",
"returns",
"when",
"the",
"given",
"Operation",
"has",
"been",
"added",
"to",
"the",
"internal",
"queue",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java#L208-L226 |
131,811 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java | OperationProcessor.throttle | private CompletableFuture<Void> throttle() {
val delay = new AtomicReference<ThrottlerCalculator.DelayResult>(this.throttlerCalculator.getThrottlingDelay());
if (!delay.get().isMaximum()) {
// We are not delaying the maximum amount. We only need to do this once.
return throttleOn... | java | private CompletableFuture<Void> throttle() {
val delay = new AtomicReference<ThrottlerCalculator.DelayResult>(this.throttlerCalculator.getThrottlingDelay());
if (!delay.get().isMaximum()) {
// We are not delaying the maximum amount. We only need to do this once.
return throttleOn... | [
"private",
"CompletableFuture",
"<",
"Void",
">",
"throttle",
"(",
")",
"{",
"val",
"delay",
"=",
"new",
"AtomicReference",
"<",
"ThrottlerCalculator",
".",
"DelayResult",
">",
"(",
"this",
".",
"throttlerCalculator",
".",
"getThrottlingDelay",
"(",
")",
")",
... | region Queue Processing | [
"region",
"Queue",
"Processing"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java#L232-L247 |
131,812 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java | OperationProcessor.closeQueue | private void closeQueue(Throwable causingException) {
// Close the operation queue and extract any outstanding Operations from it.
Collection<CompletableOperation> remainingOperations = this.operationQueue.close();
if (remainingOperations != null && remainingOperations.size() > 0) {
... | java | private void closeQueue(Throwable causingException) {
// Close the operation queue and extract any outstanding Operations from it.
Collection<CompletableOperation> remainingOperations = this.operationQueue.close();
if (remainingOperations != null && remainingOperations.size() > 0) {
... | [
"private",
"void",
"closeQueue",
"(",
"Throwable",
"causingException",
")",
"{",
"// Close the operation queue and extract any outstanding Operations from it.",
"Collection",
"<",
"CompletableOperation",
">",
"remainingOperations",
"=",
"this",
".",
"operationQueue",
".",
"clos... | Closes the Operation Queue and fails all Operations in it with the given exception.
@param causingException The exception to fail with. If null, it will default to ObjectClosedException. | [
"Closes",
"the",
"Operation",
"Queue",
"and",
"fails",
"all",
"Operations",
"in",
"it",
"with",
"the",
"given",
"exception",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java#L374-L387 |
131,813 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java | OperationProcessor.cancelIncompleteOperations | private void cancelIncompleteOperations(Iterable<CompletableOperation> operations, Throwable failException) {
assert failException != null : "no exception to set";
int cancelCount = 0;
for (CompletableOperation o : operations) {
if (!o.isDone()) {
this.state.failOpera... | java | private void cancelIncompleteOperations(Iterable<CompletableOperation> operations, Throwable failException) {
assert failException != null : "no exception to set";
int cancelCount = 0;
for (CompletableOperation o : operations) {
if (!o.isDone()) {
this.state.failOpera... | [
"private",
"void",
"cancelIncompleteOperations",
"(",
"Iterable",
"<",
"CompletableOperation",
">",
"operations",
",",
"Throwable",
"failException",
")",
"{",
"assert",
"failException",
"!=",
"null",
":",
"\"no exception to set\"",
";",
"int",
"cancelCount",
"=",
"0",... | Cancels those Operations in the given list that have not yet completed with the given exception. | [
"Cancels",
"those",
"Operations",
"in",
"the",
"given",
"list",
"that",
"have",
"not",
"yet",
"completed",
"with",
"the",
"given",
"exception",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java#L392-L403 |
131,814 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/admin/commands/Command.java | Command.createZKClient | protected CuratorFramework createZKClient() {
val serviceConfig = getServiceConfig();
CuratorFramework zkClient = CuratorFrameworkFactory
.builder()
.connectString(serviceConfig.getZkURL())
.namespace("pravega/" + serviceConfig.getClusterName())
... | java | protected CuratorFramework createZKClient() {
val serviceConfig = getServiceConfig();
CuratorFramework zkClient = CuratorFrameworkFactory
.builder()
.connectString(serviceConfig.getZkURL())
.namespace("pravega/" + serviceConfig.getClusterName())
... | [
"protected",
"CuratorFramework",
"createZKClient",
"(",
")",
"{",
"val",
"serviceConfig",
"=",
"getServiceConfig",
"(",
")",
";",
"CuratorFramework",
"zkClient",
"=",
"CuratorFrameworkFactory",
".",
"builder",
"(",
")",
".",
"connectString",
"(",
"serviceConfig",
".... | Creates a new instance of the CuratorFramework class using configuration from the shared AdminCommandState. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"CuratorFramework",
"class",
"using",
"configuration",
"from",
"the",
"shared",
"AdminCommandState",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/admin/commands/Command.java#L84-L95 |
131,815 | pravega/pravega | controller/src/main/java/io/pravega/controller/fault/SegmentMonitorLeader.java | SegmentMonitorLeader.takeLeadership | @Override
@Synchronized
public void takeLeadership(CuratorFramework client) throws Exception {
log.info("Obtained leadership to monitor the Host to Segment Container Mapping");
//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.
hostsChange.release... | java | @Override
@Synchronized
public void takeLeadership(CuratorFramework client) throws Exception {
log.info("Obtained leadership to monitor the Host to Segment Container Mapping");
//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.
hostsChange.release... | [
"@",
"Override",
"@",
"Synchronized",
"public",
"void",
"takeLeadership",
"(",
"CuratorFramework",
"client",
")",
"throws",
"Exception",
"{",
"log",
".",
"info",
"(",
"\"Obtained leadership to monitor the Host to Segment Container Mapping\"",
")",
";",
"//Attempt a rebalanc... | This function is called when the current instance is made the leader. The leadership is relinquished when this
function exits.
@param client The curator client.
@throws Exception On any error. This would result in leadership being relinquished. | [
"This",
"function",
"is",
"called",
"when",
"the",
"current",
"instance",
"is",
"made",
"the",
"leader",
".",
"The",
"leadership",
"is",
"relinquished",
"when",
"this",
"function",
"exits",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/fault/SegmentMonitorLeader.java#L108-L173 |
131,816 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/handler/AppendProcessor.java | AppendProcessor.performNextWrite | private void performNextWrite() {
Append append = getNextAppend();
if (append == null) {
return;
}
long traceId = LoggerHelpers.traceEnter(log, "storeAppend", append);
Timer timer = new Timer();
storeAppend(append)
.whenComplete((v, e) -> {
... | java | private void performNextWrite() {
Append append = getNextAppend();
if (append == null) {
return;
}
long traceId = LoggerHelpers.traceEnter(log, "storeAppend", append);
Timer timer = new Timer();
storeAppend(append)
.whenComplete((v, e) -> {
... | [
"private",
"void",
"performNextWrite",
"(",
")",
"{",
"Append",
"append",
"=",
"getNextAppend",
"(",
")",
";",
"if",
"(",
"append",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnter",
"(",
"log",
",",
... | If there isn't already an append outstanding against the store, write a new one.
Appends are opportunistically batched here. i.e. If many are waiting they are combined into a single append and
that is written. | [
"If",
"there",
"isn",
"t",
"already",
"an",
"append",
"outstanding",
"against",
"the",
"store",
"write",
"a",
"new",
"one",
".",
"Appends",
"are",
"opportunistically",
"batched",
"here",
".",
"i",
".",
"e",
".",
"If",
"many",
"are",
"waiting",
"they",
"a... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/handler/AppendProcessor.java#L187-L200 |
131,817 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/handler/AppendProcessor.java | AppendProcessor.pauseOrResumeReading | private void pauseOrResumeReading() {
int bytesWaiting;
synchronized (lock) {
bytesWaiting = waitingAppends.values()
.stream()
.mapToInt(a -> a.getData().readableBytes())
.sum();
}
if (bytesWaiting > HIGH_WATER_MARK... | java | private void pauseOrResumeReading() {
int bytesWaiting;
synchronized (lock) {
bytesWaiting = waitingAppends.values()
.stream()
.mapToInt(a -> a.getData().readableBytes())
.sum();
}
if (bytesWaiting > HIGH_WATER_MARK... | [
"private",
"void",
"pauseOrResumeReading",
"(",
")",
"{",
"int",
"bytesWaiting",
";",
"synchronized",
"(",
"lock",
")",
"{",
"bytesWaiting",
"=",
"waitingAppends",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"mapToInt",
"(",
"a",
"->",
"a",
".... | If there is too much data waiting throttle the producer by stopping consumption from the socket.
If there is room for more data, we resume consuming from the socket. | [
"If",
"there",
"is",
"too",
"much",
"data",
"waiting",
"throttle",
"the",
"producer",
"by",
"stopping",
"consumption",
"from",
"the",
"socket",
".",
"If",
"there",
"is",
"room",
"for",
"more",
"data",
"we",
"resume",
"consuming",
"from",
"the",
"socket",
"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/handler/AppendProcessor.java#L365-L382 |
131,818 | pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/handler/AppendProcessor.java | AppendProcessor.append | @Override
public void append(Append append) {
log.trace("Processing append received from client {}", append);
UUID id = append.getWriterId();
synchronized (lock) {
Long lastEventNumber = latestEventNumbers.get(Pair.of(append.getSegment(), id));
Preconditions.checkStat... | java | @Override
public void append(Append append) {
log.trace("Processing append received from client {}", append);
UUID id = append.getWriterId();
synchronized (lock) {
Long lastEventNumber = latestEventNumbers.get(Pair.of(append.getSegment(), id));
Preconditions.checkStat... | [
"@",
"Override",
"public",
"void",
"append",
"(",
"Append",
"append",
")",
"{",
"log",
".",
"trace",
"(",
"\"Processing append received from client {}\"",
",",
"append",
")",
";",
"UUID",
"id",
"=",
"append",
".",
"getWriterId",
"(",
")",
";",
"synchronized",
... | Append data to the store.
Because ordering dictates that there only be one outstanding append from a given connection, this is implemented
by adding the append to a queue. | [
"Append",
"data",
"to",
"the",
"store",
".",
"Because",
"ordering",
"dictates",
"that",
"there",
"only",
"be",
"one",
"outstanding",
"append",
"from",
"a",
"given",
"connection",
"this",
"is",
"implemented",
"by",
"adding",
"the",
"append",
"to",
"a",
"queue... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/handler/AppendProcessor.java#L389-L401 |
131,819 | pravega/pravega | common/src/main/java/io/pravega/common/util/TypedProperties.java | TypedProperties.get | public String get(Property<String> property) throws ConfigurationException {
return tryGet(property, s -> s);
} | java | public String get(Property<String> property) throws ConfigurationException {
return tryGet(property, s -> s);
} | [
"public",
"String",
"get",
"(",
"Property",
"<",
"String",
">",
"property",
")",
"throws",
"ConfigurationException",
"{",
"return",
"tryGet",
"(",
"property",
",",
"s",
"->",
"s",
")",
";",
"}"
] | Gets the value of a String property.
@param property The Property to get.
@return The property value or default value, if no such is defined in the base Properties.
@throws ConfigurationException When the given property name does not exist within the current component and the property
does not have a default value set... | [
"Gets",
"the",
"value",
"of",
"a",
"String",
"property",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/TypedProperties.java#L67-L69 |
131,820 | pravega/pravega | common/src/main/java/io/pravega/common/util/TypedProperties.java | TypedProperties.getEnum | public <T extends Enum<T>> T getEnum(Property<T> property, Class<T> enumClass) throws ConfigurationException {
return tryGet(property, s -> Enum.valueOf(enumClass, s));
} | java | public <T extends Enum<T>> T getEnum(Property<T> property, Class<T> enumClass) throws ConfigurationException {
return tryGet(property, s -> Enum.valueOf(enumClass, s));
} | [
"public",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnum",
"(",
"Property",
"<",
"T",
">",
"property",
",",
"Class",
"<",
"T",
">",
"enumClass",
")",
"throws",
"ConfigurationException",
"{",
"return",
"tryGet",
"(",
"property",
",",
"s"... | Gets the value of an Enumeration property.
@param property The Property to get.
@param enumClass Class defining return type.
@param <T> Type of Enumeration.
@return The property value or default value, if no such is defined in the base Properties.
@throws ConfigurationException When the given property name does... | [
"Gets",
"the",
"value",
"of",
"an",
"Enumeration",
"property",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/TypedProperties.java#L105-L107 |
131,821 | pravega/pravega | client/src/main/java/io/pravega/client/netty/impl/FlowHandler.java | FlowHandler.createFlow | public ClientConnection createFlow(final Flow flow, final ReplyProcessor rp) {
Exceptions.checkNotClosed(closed.get(), this);
Preconditions.checkState(!disableFlow.get(), "Ensure flows are enabled.");
log.info("Creating Flow {} for endpoint {}. The current Channel is {}.", flow.getFlowId(), conn... | java | public ClientConnection createFlow(final Flow flow, final ReplyProcessor rp) {
Exceptions.checkNotClosed(closed.get(), this);
Preconditions.checkState(!disableFlow.get(), "Ensure flows are enabled.");
log.info("Creating Flow {} for endpoint {}. The current Channel is {}.", flow.getFlowId(), conn... | [
"public",
"ClientConnection",
"createFlow",
"(",
"final",
"Flow",
"flow",
",",
"final",
"ReplyProcessor",
"rp",
")",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"closed",
".",
"get",
"(",
")",
",",
"this",
")",
";",
"Preconditions",
".",
"checkState",
"("... | Create a flow on existing connection.
@param flow Flow.
@param rp ReplyProcessor for the specified flow.
@return Client Connection object. | [
"Create",
"a",
"flow",
"on",
"existing",
"connection",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/netty/impl/FlowHandler.java#L64-L72 |
131,822 | pravega/pravega | client/src/main/java/io/pravega/client/netty/impl/FlowHandler.java | FlowHandler.closeFlow | public void closeFlow(ClientConnection clientConnection) {
final ClientConnectionImpl clientConnectionImpl = (ClientConnectionImpl) clientConnection;
int flow = clientConnectionImpl.getFlowId();
log.info("Closing Flow {} for endpoint {}", flow, clientConnectionImpl.getConnectionName());
... | java | public void closeFlow(ClientConnection clientConnection) {
final ClientConnectionImpl clientConnectionImpl = (ClientConnectionImpl) clientConnection;
int flow = clientConnectionImpl.getFlowId();
log.info("Closing Flow {} for endpoint {}", flow, clientConnectionImpl.getConnectionName());
... | [
"public",
"void",
"closeFlow",
"(",
"ClientConnection",
"clientConnection",
")",
"{",
"final",
"ClientConnectionImpl",
"clientConnectionImpl",
"=",
"(",
"ClientConnectionImpl",
")",
"clientConnection",
";",
"int",
"flow",
"=",
"clientConnectionImpl",
".",
"getFlowId",
"... | Close a flow. This is invoked when the ClientConnection is closed.
@param clientConnection Client Connection. | [
"Close",
"a",
"flow",
".",
"This",
"is",
"invoked",
"when",
"the",
"ClientConnection",
"is",
"closed",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/netty/impl/FlowHandler.java#L92-L97 |
131,823 | pravega/pravega | client/src/main/java/io/pravega/client/netty/impl/FlowHandler.java | FlowHandler.completeWhenRegistered | void completeWhenRegistered(final CompletableFuture<Void> future) {
Preconditions.checkNotNull(future, "future");
registeredFutureLatch.register(future);
} | java | void completeWhenRegistered(final CompletableFuture<Void> future) {
Preconditions.checkNotNull(future, "future");
registeredFutureLatch.register(future);
} | [
"void",
"completeWhenRegistered",
"(",
"final",
"CompletableFuture",
"<",
"Void",
">",
"future",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"future",
",",
"\"future\"",
")",
";",
"registeredFutureLatch",
".",
"register",
"(",
"future",
")",
";",
"}"
] | This function completes the input future when the channel is registered.
@param future CompletableFuture which will be completed once the channel is registered. | [
"This",
"function",
"completes",
"the",
"input",
"future",
"when",
"the",
"channel",
"is",
"registered",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/netty/impl/FlowHandler.java#L139-L142 |
131,824 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/PageCollection.java | PageCollection.getRootPage | synchronized PageWrapper getRootPage() {
return this.pageByOffset.values().stream()
.filter(page -> page.getParent() == null)
.findFirst().orElse(null);
} | java | synchronized PageWrapper getRootPage() {
return this.pageByOffset.values().stream()
.filter(page -> page.getParent() == null)
.findFirst().orElse(null);
} | [
"synchronized",
"PageWrapper",
"getRootPage",
"(",
")",
"{",
"return",
"this",
".",
"pageByOffset",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"page",
"->",
"page",
".",
"getParent",
"(",
")",
"==",
"null",
")",
".",
"findFir... | Gets a pointer to the Root Page. | [
"Gets",
"a",
"pointer",
"to",
"the",
"Root",
"Page",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/PageCollection.java#L99-L103 |
131,825 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.initializeReader | void initializeReader(long initialAllocationDelay) {
boolean alreadyAdded = sync.updateState((state, updates) -> {
if (state.getSegments(readerId) == null) {
log.debug("Adding reader {} to reader grop. CurrentState is: {}", readerId, state);
updates.add(new AddReader(... | java | void initializeReader(long initialAllocationDelay) {
boolean alreadyAdded = sync.updateState((state, updates) -> {
if (state.getSegments(readerId) == null) {
log.debug("Adding reader {} to reader grop. CurrentState is: {}", readerId, state);
updates.add(new AddReader(... | [
"void",
"initializeReader",
"(",
"long",
"initialAllocationDelay",
")",
"{",
"boolean",
"alreadyAdded",
"=",
"sync",
".",
"updateState",
"(",
"(",
"state",
",",
"updates",
")",
"->",
"{",
"if",
"(",
"state",
".",
"getSegments",
"(",
"readerId",
")",
"==",
... | Add this reader to the reader group so that it is able to acquire segments | [
"Add",
"this",
"reader",
"to",
"the",
"reader",
"group",
"so",
"that",
"it",
"is",
"able",
"to",
"acquire",
"segments"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L103-L119 |
131,826 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.readerShutdown | static void readerShutdown(String readerId, Position lastPosition, StateSynchronizer<ReaderGroupState> sync) {
sync.updateState((state, updates) -> {
Set<Segment> segments = state.getSegments(readerId);
if (segments == null) {
return;
}
log.debug("... | java | static void readerShutdown(String readerId, Position lastPosition, StateSynchronizer<ReaderGroupState> sync) {
sync.updateState((state, updates) -> {
Set<Segment> segments = state.getSegments(readerId);
if (segments == null) {
return;
}
log.debug("... | [
"static",
"void",
"readerShutdown",
"(",
"String",
"readerId",
",",
"Position",
"lastPosition",
",",
"StateSynchronizer",
"<",
"ReaderGroupState",
">",
"sync",
")",
"{",
"sync",
".",
"updateState",
"(",
"(",
"state",
",",
"updates",
")",
"->",
"{",
"Set",
"<... | Shuts down a reader, releasing all of its segments. The reader should cease all operations.
@param lastPosition The last position the reader successfully read from. | [
"Shuts",
"down",
"a",
"reader",
"releasing",
"all",
"of",
"its",
"segments",
".",
"The",
"reader",
"should",
"cease",
"all",
"operations",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L133-L143 |
131,827 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.handleEndOfSegment | boolean handleEndOfSegment(Segment segmentCompleted) throws ReaderNotInReaderGroupException {
final Map<Segment, List<Long>> segmentToPredecessor;
if (sync.getState().getEndSegments().containsKey(segmentCompleted)) {
segmentToPredecessor = Collections.emptyMap();
} else {
... | java | boolean handleEndOfSegment(Segment segmentCompleted) throws ReaderNotInReaderGroupException {
final Map<Segment, List<Long>> segmentToPredecessor;
if (sync.getState().getEndSegments().containsKey(segmentCompleted)) {
segmentToPredecessor = Collections.emptyMap();
} else {
... | [
"boolean",
"handleEndOfSegment",
"(",
"Segment",
"segmentCompleted",
")",
"throws",
"ReaderNotInReaderGroupException",
"{",
"final",
"Map",
"<",
"Segment",
",",
"List",
"<",
"Long",
">",
">",
"segmentToPredecessor",
";",
"if",
"(",
"sync",
".",
"getState",
"(",
... | Handles a segment being completed by calling the controller to gather all successors to the
completed segment. To ensure consistent checkpoints, a segment cannot be released while a
checkpoint for the reader is pending, so it may or may not succeed.
@return true if the completed segment was released successfully. | [
"Handles",
"a",
"segment",
"being",
"completed",
"by",
"calling",
"the",
"controller",
"to",
"gather",
"all",
"successors",
"to",
"the",
"completed",
"segment",
".",
"To",
"ensure",
"consistent",
"checkpoints",
"a",
"segment",
"cannot",
"be",
"released",
"while"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L156-L185 |
131,828 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.findSegmentToReleaseIfRequired | Segment findSegmentToReleaseIfRequired() {
fetchUpdatesIfNeeded();
Segment segment = null;
synchronized (decisionLock) {
if (!releaseTimer.hasRemaining() && sync.getState().getCheckpointForReader(readerId) == null
&& doesReaderOwnTooManySegments(sync.getState())) ... | java | Segment findSegmentToReleaseIfRequired() {
fetchUpdatesIfNeeded();
Segment segment = null;
synchronized (decisionLock) {
if (!releaseTimer.hasRemaining() && sync.getState().getCheckpointForReader(readerId) == null
&& doesReaderOwnTooManySegments(sync.getState())) ... | [
"Segment",
"findSegmentToReleaseIfRequired",
"(",
")",
"{",
"fetchUpdatesIfNeeded",
"(",
")",
";",
"Segment",
"segment",
"=",
"null",
";",
"synchronized",
"(",
"decisionLock",
")",
"{",
"if",
"(",
"!",
"releaseTimer",
".",
"hasRemaining",
"(",
")",
"&&",
"sync... | If a segment should be released because the distribution of segments is imbalanced and
this reader has not done so in a while, this returns the segment that should be released. | [
"If",
"a",
"segment",
"should",
"be",
"released",
"because",
"the",
"distribution",
"of",
"segments",
"is",
"imbalanced",
"and",
"this",
"reader",
"has",
"not",
"done",
"so",
"in",
"a",
"while",
"this",
"returns",
"the",
"segment",
"that",
"should",
"be",
... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L191-L205 |
131,829 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.doesReaderOwnTooManySegments | private boolean doesReaderOwnTooManySegments(ReaderGroupState state) {
Map<String, Double> sizesOfAssignemnts = state.getRelativeSizes();
Set<Segment> assignedSegments = state.getSegments(readerId);
if (sizesOfAssignemnts.isEmpty() || assignedSegments == null || assignedSegments.size() <= 1) {
... | java | private boolean doesReaderOwnTooManySegments(ReaderGroupState state) {
Map<String, Double> sizesOfAssignemnts = state.getRelativeSizes();
Set<Segment> assignedSegments = state.getSegments(readerId);
if (sizesOfAssignemnts.isEmpty() || assignedSegments == null || assignedSegments.size() <= 1) {
... | [
"private",
"boolean",
"doesReaderOwnTooManySegments",
"(",
"ReaderGroupState",
"state",
")",
"{",
"Map",
"<",
"String",
",",
"Double",
">",
"sizesOfAssignemnts",
"=",
"state",
".",
"getRelativeSizes",
"(",
")",
";",
"Set",
"<",
"Segment",
">",
"assignedSegments",
... | Returns true if this reader owns multiple segments and has more than a full segment more than
the reader with the least assigned to it. | [
"Returns",
"true",
"if",
"this",
"reader",
"owns",
"multiple",
"segments",
"and",
"has",
"more",
"than",
"a",
"full",
"segment",
"more",
"than",
"the",
"reader",
"with",
"the",
"least",
"assigned",
"to",
"it",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L211-L219 |
131,830 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.findSegmentToRelease | private Segment findSegmentToRelease() {
Set<Segment> segments = sync.getState().getSegments(readerId);
return segments.stream()
.max((s1, s2) -> Double.compare(hashHelper.hashToRange(s1.getScopedName()),
hashHelper.hashToRang... | java | private Segment findSegmentToRelease() {
Set<Segment> segments = sync.getState().getSegments(readerId);
return segments.stream()
.max((s1, s2) -> Double.compare(hashHelper.hashToRange(s1.getScopedName()),
hashHelper.hashToRang... | [
"private",
"Segment",
"findSegmentToRelease",
"(",
")",
"{",
"Set",
"<",
"Segment",
">",
"segments",
"=",
"sync",
".",
"getState",
"(",
")",
".",
"getSegments",
"(",
"readerId",
")",
";",
"return",
"segments",
".",
"stream",
"(",
")",
".",
"max",
"(",
... | Given a set of segments returns one to release. The one returned is arbitrary. | [
"Given",
"a",
"set",
"of",
"segments",
"returns",
"one",
"to",
"release",
".",
"The",
"one",
"returned",
"is",
"arbitrary",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L224-L230 |
131,831 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.getEndOffsetForSegment | long getEndOffsetForSegment(Segment segment) {
return Optional.ofNullable(sync.getState().getEndSegments().get(segment)).orElse(Long.MAX_VALUE);
} | java | long getEndOffsetForSegment(Segment segment) {
return Optional.ofNullable(sync.getState().getEndSegments().get(segment)).orElse(Long.MAX_VALUE);
} | [
"long",
"getEndOffsetForSegment",
"(",
"Segment",
"segment",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"sync",
".",
"getState",
"(",
")",
".",
"getEndSegments",
"(",
")",
".",
"get",
"(",
"segment",
")",
")",
".",
"orElse",
"(",
"Long",
"."... | Fetch the configured end offset for a configured segment. If end offset is not configured return Long.MAX_VALUE.
@param segment Segment.
@return endOffset of the segment. | [
"Fetch",
"the",
"configured",
"end",
"offset",
"for",
"a",
"configured",
"segment",
".",
"If",
"end",
"offset",
"is",
"not",
"configured",
"return",
"Long",
".",
"MAX_VALUE",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L238-L240 |
131,832 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.releaseSegment | boolean releaseSegment(Segment segment, long lastOffset, long timeLag) throws ReaderNotInReaderGroupException {
sync.updateState((state, updates) -> {
Set<Segment> segments = state.getSegments(readerId);
if (segments != null && segments.contains(segment) && state.getCheckpointForReader(r... | java | boolean releaseSegment(Segment segment, long lastOffset, long timeLag) throws ReaderNotInReaderGroupException {
sync.updateState((state, updates) -> {
Set<Segment> segments = state.getSegments(readerId);
if (segments != null && segments.contains(segment) && state.getCheckpointForReader(r... | [
"boolean",
"releaseSegment",
"(",
"Segment",
"segment",
",",
"long",
"lastOffset",
",",
"long",
"timeLag",
")",
"throws",
"ReaderNotInReaderGroupException",
"{",
"sync",
".",
"updateState",
"(",
"(",
"state",
",",
"updates",
")",
"->",
"{",
"Set",
"<",
"Segmen... | Releases a segment to another reader. This reader should no longer read from the segment.
@param segment The segment to be released
@param lastOffset The offset from which the new owner should start reading from.
@param timeLag How far the reader is from the tail of the stream in time.
@return a boolean indicating if ... | [
"Releases",
"a",
"segment",
"to",
"another",
"reader",
".",
"This",
"reader",
"should",
"no",
"longer",
"read",
"from",
"the",
"segment",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L251-L267 |
131,833 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.acquireNewSegmentsIfNeeded | Map<Segment, Long> acquireNewSegmentsIfNeeded(long timeLag) throws ReaderNotInReaderGroupException {
fetchUpdatesIfNeeded();
if (shouldAcquireSegment()) {
return acquireSegment(timeLag);
} else {
return Collections.emptyMap();
}
} | java | Map<Segment, Long> acquireNewSegmentsIfNeeded(long timeLag) throws ReaderNotInReaderGroupException {
fetchUpdatesIfNeeded();
if (shouldAcquireSegment()) {
return acquireSegment(timeLag);
} else {
return Collections.emptyMap();
}
} | [
"Map",
"<",
"Segment",
",",
"Long",
">",
"acquireNewSegmentsIfNeeded",
"(",
"long",
"timeLag",
")",
"throws",
"ReaderNotInReaderGroupException",
"{",
"fetchUpdatesIfNeeded",
"(",
")",
";",
"if",
"(",
"shouldAcquireSegment",
"(",
")",
")",
"{",
"return",
"acquireSe... | If there are unassigned segments and this host has not acquired one in a while, acquires them.
@return A map from the new segment that was acquired to the offset to begin reading from within the segment. | [
"If",
"there",
"are",
"unassigned",
"segments",
"and",
"this",
"host",
"has",
"not",
"acquired",
"one",
"in",
"a",
"while",
"acquires",
"them",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L278-L285 |
131,834 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Services.java | Services.startAsync | public static CompletableFuture<Void> startAsync(Service service, Executor executor) {
// Service.startAsync() will fail if the service is not in a NEW state. That is, if it is already RUNNING or
// STARTED, then the method will fail synchronously, hence we are not in danger of not invoking our callback... | java | public static CompletableFuture<Void> startAsync(Service service, Executor executor) {
// Service.startAsync() will fail if the service is not in a NEW state. That is, if it is already RUNNING or
// STARTED, then the method will fail synchronously, hence we are not in danger of not invoking our callback... | [
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"startAsync",
"(",
"Service",
"service",
",",
"Executor",
"executor",
")",
"{",
"// Service.startAsync() will fail if the service is not in a NEW state. That is, if it is already RUNNING or",
"// STARTED, then the method will... | Asynchronously starts a Service and returns a CompletableFuture that will indicate when it is running.
@param service The Service to start.
@param executor An Executor to use for callback invocations.
@return A CompletableFuture that will be completed when the service enters a RUNNING state, or completed
exceptionall... | [
"Asynchronously",
"starts",
"a",
"Service",
"and",
"returns",
"a",
"CompletableFuture",
"that",
"will",
"indicate",
"when",
"it",
"is",
"running",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Services.java#L34-L46 |
131,835 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Services.java | Services.stopAsync | public static CompletableFuture<Void> stopAsync(Service service, Executor executor) {
// Service.stopAsync() will not throw any exceptions, but will transition the Service to either TERMINATED
// or FAILED. We need to register the listener before we attempt to stop.
CompletableFuture<Void> resul... | java | public static CompletableFuture<Void> stopAsync(Service service, Executor executor) {
// Service.stopAsync() will not throw any exceptions, but will transition the Service to either TERMINATED
// or FAILED. We need to register the listener before we attempt to stop.
CompletableFuture<Void> resul... | [
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"stopAsync",
"(",
"Service",
"service",
",",
"Executor",
"executor",
")",
"{",
"// Service.stopAsync() will not throw any exceptions, but will transition the Service to either TERMINATED",
"// or FAILED. We need to register t... | Asynchronously stops a Service and returns a CompletableFuture that will indicate when it is stopped.
@param service The Service to stop.
@param executor An Executor to use for callback invocations.
@return A CompletableFuture that will be completed when the service enters a TERMINATED state, or completed
exceptional... | [
"Asynchronously",
"stops",
"a",
"Service",
"and",
"returns",
"a",
"CompletableFuture",
"that",
"will",
"indicate",
"when",
"it",
"is",
"stopped",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Services.java#L56-L63 |
131,836 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Services.java | Services.onStop | public static void onStop(Service service, Runnable terminatedCallback, Consumer<Throwable> failureCallback, Executor executor) {
ShutdownListener listener = new ShutdownListener(terminatedCallback, failureCallback);
service.addListener(listener, executor);
// addListener() will not invoke the ... | java | public static void onStop(Service service, Runnable terminatedCallback, Consumer<Throwable> failureCallback, Executor executor) {
ShutdownListener listener = new ShutdownListener(terminatedCallback, failureCallback);
service.addListener(listener, executor);
// addListener() will not invoke the ... | [
"public",
"static",
"void",
"onStop",
"(",
"Service",
"service",
",",
"Runnable",
"terminatedCallback",
",",
"Consumer",
"<",
"Throwable",
">",
"failureCallback",
",",
"Executor",
"executor",
")",
"{",
"ShutdownListener",
"listener",
"=",
"new",
"ShutdownListener",
... | Attaches the given callbacks which will be invoked when the given Service enters a TERMINATED or FAILED state.
The callbacks are optional and may be invoked synchronously if the Service is already in one of these states.
@param service The Service to attach to.
@param terminatedCallback (Optional) A Runnabl... | [
"Attaches",
"the",
"given",
"callbacks",
"which",
"will",
"be",
"invoked",
"when",
"the",
"given",
"Service",
"enters",
"a",
"TERMINATED",
"or",
"FAILED",
"state",
".",
"The",
"callbacks",
"are",
"optional",
"and",
"may",
"be",
"invoked",
"synchronously",
"if"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Services.java#L74-L88 |
131,837 | pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Services.java | Services.isTerminating | public static boolean isTerminating(Service.State state) {
return state == Service.State.STOPPING
|| state == Service.State.TERMINATED
|| state == Service.State.FAILED;
} | java | public static boolean isTerminating(Service.State state) {
return state == Service.State.STOPPING
|| state == Service.State.TERMINATED
|| state == Service.State.FAILED;
} | [
"public",
"static",
"boolean",
"isTerminating",
"(",
"Service",
".",
"State",
"state",
")",
"{",
"return",
"state",
"==",
"Service",
".",
"State",
".",
"STOPPING",
"||",
"state",
"==",
"Service",
".",
"State",
".",
"TERMINATED",
"||",
"state",
"==",
"Servi... | Determines whether the given Service.State indicates the Service is either in the process of Stopping or already
Terminated or Failed.
@param state The Service.State to test.
@return Whether this is a terminating state. | [
"Determines",
"whether",
"the",
"given",
"Service",
".",
"State",
"indicates",
"the",
"Service",
"is",
"either",
"in",
"the",
"process",
"of",
"Stopping",
"or",
"already",
"Terminated",
"or",
"Failed",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Services.java#L97-L101 |
131,838 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.createTransaction | public void createTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION, 1, streamTags(scope, streamName));
createTransactionLatency.reportSuccessValue(latency.to... | java | public void createTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION, 1, streamTags(scope, streamName));
createTransactionLatency.reportSuccessValue(latency.to... | [
"public",
"void",
"createTransaction",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"Duration",
"latency",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"CREATE_TRANSACTION",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER... | This method increments the global and Stream-related counters of created Transactions and reports the latency of
the operation.
@param scope Scope.
@param streamName Name of the Stream.
@param latency Latency of the create Transaction operation. | [
"This",
"method",
"increments",
"the",
"global",
"and",
"Stream",
"-",
"related",
"counters",
"of",
"created",
"Transactions",
"and",
"reports",
"the",
"latency",
"of",
"the",
"operation",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L46-L50 |
131,839 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.createTransactionFailed | public void createTransactionFailed(String scope, String streamName) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION_FAILED, 1, streamTags(scope, streamName));
} | java | public void createTransactionFailed(String scope, String streamName) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION_FAILED, 1, streamTags(scope, streamName));
} | [
"public",
"void",
"createTransactionFailed",
"(",
"String",
"scope",
",",
"String",
"streamName",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"CREATE_TRANSACTION_FAILED",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER",
".",
"incCount... | This method increments the global and Stream-related counters of failed Transaction create operations.
@param scope Scope.
@param streamName Name of the Stream. | [
"This",
"method",
"increments",
"the",
"global",
"and",
"Stream",
"-",
"related",
"counters",
"of",
"failed",
"Transaction",
"create",
"operations",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L58-L61 |
131,840 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.commitTransaction | public void commitTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION, 1, streamTags(scope, streamName));
commitTransactionLatency.reportSuccessValue(latency.to... | java | public void commitTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION, 1, streamTags(scope, streamName));
commitTransactionLatency.reportSuccessValue(latency.to... | [
"public",
"void",
"commitTransaction",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"Duration",
"latency",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"COMMIT_TRANSACTION",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER... | This method increments the global and Stream-related counters of committed Transactions and reports the latency
of the operation.
@param scope Scope.
@param streamName Name of the Stream.
@param latency Latency of the commit Transaction operation. | [
"This",
"method",
"increments",
"the",
"global",
"and",
"Stream",
"-",
"related",
"counters",
"of",
"committed",
"Transactions",
"and",
"reports",
"the",
"latency",
"of",
"the",
"operation",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L71-L75 |
131,841 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.commitTransactionFailed | public void commitTransactionFailed(String scope, String streamName, String txnId) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION_FAILED, 1, streamTags(scope, streamName));
DYNAMIC_LOGGER.incCounterValue(COMMIT_... | java | public void commitTransactionFailed(String scope, String streamName, String txnId) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(COMMIT_TRANSACTION_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(COMMIT_TRANSACTION_FAILED, 1, streamTags(scope, streamName));
DYNAMIC_LOGGER.incCounterValue(COMMIT_... | [
"public",
"void",
"commitTransactionFailed",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"String",
"txnId",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"COMMIT_TRANSACTION_FAILED",
")",
",",
"1",
")",
";",
"DYNAM... | This method increments the global, Stream-related and Transaction-related counters of failed commit operations.
@param scope Scope.
@param streamName Name of the Stream.
@param txnId Transaction id. | [
"This",
"method",
"increments",
"the",
"global",
"Stream",
"-",
"related",
"and",
"Transaction",
"-",
"related",
"counters",
"of",
"failed",
"commit",
"operations",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L84-L88 |
131,842 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.abortTransaction | public void abortTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(ABORT_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(ABORT_TRANSACTION, 1, streamTags(scope, streamName));
abortTransactionLatency.reportSuccessValue(latency.toMill... | java | public void abortTransaction(String scope, String streamName, Duration latency) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(ABORT_TRANSACTION), 1);
DYNAMIC_LOGGER.incCounterValue(ABORT_TRANSACTION, 1, streamTags(scope, streamName));
abortTransactionLatency.reportSuccessValue(latency.toMill... | [
"public",
"void",
"abortTransaction",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"Duration",
"latency",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"ABORT_TRANSACTION",
")",
",",
"1",
")",
";",
"DYNAMIC_LOGGER",... | This method increments the global and Stream-related counters of aborted Transactions and reports the latency
of the operation.
@param scope Scope.
@param streamName Name of the Stream.
@param latency Latency of the abort Transaction operation. | [
"This",
"method",
"increments",
"the",
"global",
"and",
"Stream",
"-",
"related",
"counters",
"of",
"aborted",
"Transactions",
"and",
"reports",
"the",
"latency",
"of",
"the",
"operation",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L98-L102 |
131,843 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.abortTransactionFailed | public void abortTransactionFailed(String scope, String streamName, String txnId) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(ABORT_TRANSACTION_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(ABORT_TRANSACTION_FAILED, 1, streamTags(scope, streamName));
DYNAMIC_LOGGER.incCounterValue(ABORT_TRAN... | java | public void abortTransactionFailed(String scope, String streamName, String txnId) {
DYNAMIC_LOGGER.incCounterValue(globalMetricName(ABORT_TRANSACTION_FAILED), 1);
DYNAMIC_LOGGER.incCounterValue(ABORT_TRANSACTION_FAILED, 1, streamTags(scope, streamName));
DYNAMIC_LOGGER.incCounterValue(ABORT_TRAN... | [
"public",
"void",
"abortTransactionFailed",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"String",
"txnId",
")",
"{",
"DYNAMIC_LOGGER",
".",
"incCounterValue",
"(",
"globalMetricName",
"(",
"ABORT_TRANSACTION_FAILED",
")",
",",
"1",
")",
";",
"DYNAMIC... | This method increments the global, Stream-related and Transaction-related counters of failed abort operations.
@param scope Scope.
@param streamName Name of the Stream.
@param txnId Transaction id. | [
"This",
"method",
"increments",
"the",
"global",
"Stream",
"-",
"related",
"and",
"Transaction",
"-",
"related",
"counters",
"of",
"failed",
"abort",
"operations",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L111-L115 |
131,844 | pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.reportOpenTransactions | public static void reportOpenTransactions(String scope, String streamName, int ongoingTransactions) {
DYNAMIC_LOGGER.reportGaugeValue(OPEN_TRANSACTIONS, ongoingTransactions, streamTags(scope, streamName));
} | java | public static void reportOpenTransactions(String scope, String streamName, int ongoingTransactions) {
DYNAMIC_LOGGER.reportGaugeValue(OPEN_TRANSACTIONS, ongoingTransactions, streamTags(scope, streamName));
} | [
"public",
"static",
"void",
"reportOpenTransactions",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"int",
"ongoingTransactions",
")",
"{",
"DYNAMIC_LOGGER",
".",
"reportGaugeValue",
"(",
"OPEN_TRANSACTIONS",
",",
"ongoingTransactions",
",",
"streamTags",
... | This method reports the current number of open Transactions for a Stream.
@param scope Scope.
@param streamName Name of the Stream.
@param ongoingTransactions Number of open Transactions in the Stream. | [
"This",
"method",
"reports",
"the",
"current",
"number",
"of",
"open",
"Transactions",
"for",
"a",
"Stream",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L124-L126 |
131,845 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rpc/auth/RESTAuthHelper.java | RESTAuthHelper.authenticate | public Principal authenticate(List<String> authHeader) throws AuthException {
if (isAuthEnabled()) {
String credentials = parseCredentials(authHeader);
return pravegaAuthManager.authenticate(credentials);
}
return null;
} | java | public Principal authenticate(List<String> authHeader) throws AuthException {
if (isAuthEnabled()) {
String credentials = parseCredentials(authHeader);
return pravegaAuthManager.authenticate(credentials);
}
return null;
} | [
"public",
"Principal",
"authenticate",
"(",
"List",
"<",
"String",
">",
"authHeader",
")",
"throws",
"AuthException",
"{",
"if",
"(",
"isAuthEnabled",
"(",
")",
")",
"{",
"String",
"credentials",
"=",
"parseCredentials",
"(",
"authHeader",
")",
";",
"return",
... | Authenticates the subject represented by the specified HTTP Authorization Header value.
@param authHeader contents of an HTTP Authorization header
@return a {@code principal} representing the identity of the subject if auth is enabled; otherwise {@code null}
@throws AuthException if authentication fails | [
"Authenticates",
"the",
"subject",
"represented",
"by",
"the",
"specified",
"HTTP",
"Authorization",
"Header",
"value",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rpc/auth/RESTAuthHelper.java#L87-L93 |
131,846 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupState.java | ReaderGroupState.getNumberOfSegments | @Synchronized
public int getNumberOfSegments() {
return assignedSegments.values().stream().mapToInt(Map::size).sum() + unassignedSegments.size();
} | java | @Synchronized
public int getNumberOfSegments() {
return assignedSegments.values().stream().mapToInt(Map::size).sum() + unassignedSegments.size();
} | [
"@",
"Synchronized",
"public",
"int",
"getNumberOfSegments",
"(",
")",
"{",
"return",
"assignedSegments",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"mapToInt",
"(",
"Map",
"::",
"size",
")",
".",
"sum",
"(",
")",
"+",
"unassignedSegments",
"... | Returns the number of segments currently being read from and that are unassigned within the reader group. | [
"Returns",
"the",
"number",
"of",
"segments",
"currently",
"being",
"read",
"from",
"and",
"that",
"are",
"unassigned",
"within",
"the",
"reader",
"group",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupState.java#L215-L218 |
131,847 | pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupState.java | ReaderGroupState.isEndOfData | @Synchronized
public boolean isEndOfData() {
return futureSegments.isEmpty() && unassignedSegments.isEmpty() &&
assignedSegments.values().stream().allMatch(Map::isEmpty);
} | java | @Synchronized
public boolean isEndOfData() {
return futureSegments.isEmpty() && unassignedSegments.isEmpty() &&
assignedSegments.values().stream().allMatch(Map::isEmpty);
} | [
"@",
"Synchronized",
"public",
"boolean",
"isEndOfData",
"(",
")",
"{",
"return",
"futureSegments",
".",
"isEmpty",
"(",
")",
"&&",
"unassignedSegments",
".",
"isEmpty",
"(",
")",
"&&",
"assignedSegments",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
... | This functions returns true if the readers part of reader group for sealed streams have completely read the data.
@return true if end of data. false if there are segments to be read from. | [
"This",
"functions",
"returns",
"true",
"if",
"the",
"readers",
"part",
"of",
"reader",
"group",
"for",
"sealed",
"streams",
"have",
"completely",
"read",
"the",
"data",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupState.java#L283-L287 |
131,848 | pravega/pravega | common/src/main/java/io/pravega/common/util/OrderedItemProcessor.java | OrderedItemProcessor.executionComplete | @VisibleForTesting
protected void executionComplete(Throwable exception) {
Collection<QueueItem> toFail = null;
Throwable failEx = null;
synchronized (this.stateLock) {
// Release the spot occupied by this item's execution.
this.activeCount--;
if (exceptio... | java | @VisibleForTesting
protected void executionComplete(Throwable exception) {
Collection<QueueItem> toFail = null;
Throwable failEx = null;
synchronized (this.stateLock) {
// Release the spot occupied by this item's execution.
this.activeCount--;
if (exceptio... | [
"@",
"VisibleForTesting",
"protected",
"void",
"executionComplete",
"(",
"Throwable",
"exception",
")",
"{",
"Collection",
"<",
"QueueItem",
">",
"toFail",
"=",
"null",
";",
"Throwable",
"failEx",
"=",
"null",
";",
"synchronized",
"(",
"this",
".",
"stateLock",
... | Callback that is invoked when an item has completed execution.
@param exception (Optional) An exception from the execution. If set, it indicates the item has not been
processed successfully. | [
"Callback",
"that",
"is",
"invoked",
"when",
"an",
"item",
"has",
"completed",
"execution",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/OrderedItemProcessor.java#L162-L212 |
131,849 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/SegmentContainerCollection.java | SegmentContainerCollection.invoke | protected <T> CompletableFuture<T> invoke(String streamSegmentName, Function<SegmentContainer, CompletableFuture<T>> toInvoke,
String methodName, Object... logArgs) {
long traceId = LoggerHelpers.traceEnter(log, methodName, logArgs);
SegmentContainer contain... | java | protected <T> CompletableFuture<T> invoke(String streamSegmentName, Function<SegmentContainer, CompletableFuture<T>> toInvoke,
String methodName, Object... logArgs) {
long traceId = LoggerHelpers.traceEnter(log, methodName, logArgs);
SegmentContainer contain... | [
"protected",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"invoke",
"(",
"String",
"streamSegmentName",
",",
"Function",
"<",
"SegmentContainer",
",",
"CompletableFuture",
"<",
"T",
">",
">",
"toInvoke",
",",
"String",
"methodName",
",",
"Object",
"...",... | Executes the given Function on the SegmentContainer that the given Segment maps to.
@param streamSegmentName The name of the StreamSegment to fetch the Container for.
@param toInvoke A Function that will be invoked on the Container.
@param methodName The name of the calling method (for logging purposes... | [
"Executes",
"the",
"given",
"Function",
"on",
"the",
"SegmentContainer",
"that",
"the",
"given",
"Segment",
"maps",
"to",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/SegmentContainerCollection.java#L61-L78 |
131,850 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.createSegment | CompletableFuture<Void> createSegment(String segmentName, Collection<AttributeUpdate> attributes, Duration timeout) {
long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "createSegment", segmentName);
long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, tr... | java | CompletableFuture<Void> createSegment(String segmentName, Collection<AttributeUpdate> attributes, Duration timeout) {
long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "createSegment", segmentName);
long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, tr... | [
"CompletableFuture",
"<",
"Void",
">",
"createSegment",
"(",
"String",
"segmentName",
",",
"Collection",
"<",
"AttributeUpdate",
">",
"attributes",
",",
"Duration",
"timeout",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnterWithContext",
"(",
"l... | Creates a new Segment with given name.
@param segmentName The case-sensitive Segment Name.
@param attributes The initial attributes for the StreamSegment, if any.
@param timeout Timeout for the operation.
@return A CompletableFuture that, when completed normally, will indicate the Segment has been created.
If the... | [
"Creates",
"a",
"new",
"Segment",
"with",
"given",
"name",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L115-L130 |
131,851 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.getSegmentInfo | CompletableFuture<SegmentProperties> getSegmentInfo(String segmentName, Duration timeout) {
long streamSegmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
CompletableFuture<SegmentProperties> result;
if (isValidSegmentId(streamSegmentId)) {
// Looks li... | java | CompletableFuture<SegmentProperties> getSegmentInfo(String segmentName, Duration timeout) {
long streamSegmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
CompletableFuture<SegmentProperties> result;
if (isValidSegmentId(streamSegmentId)) {
// Looks li... | [
"CompletableFuture",
"<",
"SegmentProperties",
">",
"getSegmentInfo",
"(",
"String",
"segmentName",
",",
"Duration",
"timeout",
")",
"{",
"long",
"streamSegmentId",
"=",
"this",
".",
"connector",
".",
"containerMetadata",
".",
"getStreamSegmentId",
"(",
"segmentName",... | Gets information about a Segment. If the Segment is active, it returns this information directly from the
in-memory Metadata. If the Segment is not active, it fetches the information from Storage and returns it, without
activating the segment in the Metadata or otherwise touching the DurableLog.
@param segmentName The... | [
"Gets",
"information",
"about",
"a",
"Segment",
".",
"If",
"the",
"Segment",
"is",
"active",
"it",
"returns",
"this",
"information",
"directly",
"from",
"the",
"in",
"-",
"memory",
"Metadata",
".",
"If",
"the",
"Segment",
"is",
"not",
"active",
"it",
"fetc... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L226-L253 |
131,852 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.updateSegmentInfo | CompletableFuture<Void> updateSegmentInfo(SegmentMetadata segmentMetadata, Duration timeout) {
if (segmentMetadata.isMerged()) {
return Futures.failedFuture(new StreamSegmentMergedException(segmentMetadata.getName()));
} else if (segmentMetadata.isDeleted()) {
return Futures.fail... | java | CompletableFuture<Void> updateSegmentInfo(SegmentMetadata segmentMetadata, Duration timeout) {
if (segmentMetadata.isMerged()) {
return Futures.failedFuture(new StreamSegmentMergedException(segmentMetadata.getName()));
} else if (segmentMetadata.isDeleted()) {
return Futures.fail... | [
"CompletableFuture",
"<",
"Void",
">",
"updateSegmentInfo",
"(",
"SegmentMetadata",
"segmentMetadata",
",",
"Duration",
"timeout",
")",
"{",
"if",
"(",
"segmentMetadata",
".",
"isMerged",
"(",
")",
")",
"{",
"return",
"Futures",
".",
"failedFuture",
"(",
"new",
... | Updates information about a Segment.
@param segmentMetadata A {@link SegmentMetadata} that will be saved in the Metadata Store.
@param timeout Timeout for the operation.
@return A CompletableFuture that, when completed, will indicate the operation succeeded. | [
"Updates",
"information",
"about",
"a",
"Segment",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L276-L285 |
131,853 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.assignSegmentId | private void assignSegmentId(String segmentName, Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
Futures.exceptionListener(
getSegmentInfoInternal(segmentName, timer.getRemaining())
.thenComposeAsync(si -> submitAssignmentWithRetry(SegmentInfo.... | java | private void assignSegmentId(String segmentName, Duration timeout) {
TimeoutTimer timer = new TimeoutTimer(timeout);
Futures.exceptionListener(
getSegmentInfoInternal(segmentName, timer.getRemaining())
.thenComposeAsync(si -> submitAssignmentWithRetry(SegmentInfo.... | [
"private",
"void",
"assignSegmentId",
"(",
"String",
"segmentName",
",",
"Duration",
"timeout",
")",
"{",
"TimeoutTimer",
"timer",
"=",
"new",
"TimeoutTimer",
"(",
"timeout",
")",
";",
"Futures",
".",
"exceptionListener",
"(",
"getSegmentInfoInternal",
"(",
"segme... | Attempts to map a Segment to an Id, by first trying to retrieve an existing id, and, should that not exist,
assign a new one.
@param segmentName The name of the Segment to assign id for.
@param timeout Timeout for the operation. | [
"Attempts",
"to",
"map",
"a",
"Segment",
"to",
"an",
"Id",
"by",
"first",
"trying",
"to",
"retrieve",
"an",
"existing",
"id",
"and",
"should",
"that",
"not",
"exist",
"assign",
"a",
"new",
"one",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L381-L387 |
131,854 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.submitAssignmentWithRetry | private CompletableFuture<Long> submitAssignmentWithRetry(SegmentInfo segmentInfo, Duration timeout) {
return retryWithCleanup(() -> submitAssignment(segmentInfo, false, timeout));
} | java | private CompletableFuture<Long> submitAssignmentWithRetry(SegmentInfo segmentInfo, Duration timeout) {
return retryWithCleanup(() -> submitAssignment(segmentInfo, false, timeout));
} | [
"private",
"CompletableFuture",
"<",
"Long",
">",
"submitAssignmentWithRetry",
"(",
"SegmentInfo",
"segmentInfo",
",",
"Duration",
"timeout",
")",
"{",
"return",
"retryWithCleanup",
"(",
"(",
")",
"->",
"submitAssignment",
"(",
"segmentInfo",
",",
"false",
",",
"t... | Same as submitAssignment, but retries exactly once in case TooManyActiveSegmentsException was encountered, in
which case it forces a metadata cleanup before retrying. If the second attempt also fails, there will be no more retry
and the Exception from the second failure will be the one that this call fails with too.
@... | [
"Same",
"as",
"submitAssignment",
"but",
"retries",
"exactly",
"once",
"in",
"case",
"TooManyActiveSegmentsException",
"was",
"encountered",
"in",
"which",
"case",
"it",
"forces",
"a",
"metadata",
"cleanup",
"before",
"retrying",
".",
"If",
"the",
"second",
"attem... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L399-L401 |
131,855 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.completeAssignment | private long completeAssignment(String streamSegmentName, long streamSegmentId) {
assert streamSegmentId != ContainerMetadata.NO_STREAM_SEGMENT_ID : "no valid streamSegmentId given";
finishPendingRequests(streamSegmentName, PendingRequest::complete, streamSegmentId);
return streamSegmentId;
... | java | private long completeAssignment(String streamSegmentName, long streamSegmentId) {
assert streamSegmentId != ContainerMetadata.NO_STREAM_SEGMENT_ID : "no valid streamSegmentId given";
finishPendingRequests(streamSegmentName, PendingRequest::complete, streamSegmentId);
return streamSegmentId;
... | [
"private",
"long",
"completeAssignment",
"(",
"String",
"streamSegmentName",
",",
"long",
"streamSegmentId",
")",
"{",
"assert",
"streamSegmentId",
"!=",
"ContainerMetadata",
".",
"NO_STREAM_SEGMENT_ID",
":",
"\"no valid streamSegmentId given\"",
";",
"finishPendingRequests",... | Completes the assignment for the given StreamSegmentName by completing the waiting CompletableFuture. | [
"Completes",
"the",
"assignment",
"for",
"the",
"given",
"StreamSegmentName",
"by",
"completing",
"the",
"waiting",
"CompletableFuture",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L438-L442 |
131,856 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.failAssignment | private void failAssignment(String streamSegmentName, Throwable reason) {
finishPendingRequests(streamSegmentName, PendingRequest::completeExceptionally, reason);
} | java | private void failAssignment(String streamSegmentName, Throwable reason) {
finishPendingRequests(streamSegmentName, PendingRequest::completeExceptionally, reason);
} | [
"private",
"void",
"failAssignment",
"(",
"String",
"streamSegmentName",
",",
"Throwable",
"reason",
")",
"{",
"finishPendingRequests",
"(",
"streamSegmentName",
",",
"PendingRequest",
"::",
"completeExceptionally",
",",
"reason",
")",
";",
"}"
] | Fails the assignment for the given StreamSegment Id with the given reason. | [
"Fails",
"the",
"assignment",
"for",
"the",
"given",
"StreamSegment",
"Id",
"with",
"the",
"given",
"reason",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L447-L449 |
131,857 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.checkConcurrentAssignment | private <T> QueuedCallback<T> checkConcurrentAssignment(String segmentName, Function<Long, CompletableFuture<T>> thenCompose) {
QueuedCallback<T> queuedCallback = null;
synchronized (this.pendingRequests) {
PendingRequest pendingRequest = this.pendingRequests.getOrDefault(segmentName, null);... | java | private <T> QueuedCallback<T> checkConcurrentAssignment(String segmentName, Function<Long, CompletableFuture<T>> thenCompose) {
QueuedCallback<T> queuedCallback = null;
synchronized (this.pendingRequests) {
PendingRequest pendingRequest = this.pendingRequests.getOrDefault(segmentName, null);... | [
"private",
"<",
"T",
">",
"QueuedCallback",
"<",
"T",
">",
"checkConcurrentAssignment",
"(",
"String",
"segmentName",
",",
"Function",
"<",
"Long",
",",
"CompletableFuture",
"<",
"T",
">",
">",
"thenCompose",
")",
"{",
"QueuedCallback",
"<",
"T",
">",
"queue... | Attempts to piggyback a task on any existing concurrent assignment, if any such assignment exists.
@param segmentName The Name of the StreamSegment to attempt to piggyback on.
@param thenCompose A Function that consumes a StreamSegmentId and returns a CompletableFuture that will indicate
when the consumption of that S... | [
"Attempts",
"to",
"piggyback",
"a",
"task",
"on",
"any",
"existing",
"concurrent",
"assignment",
"if",
"any",
"such",
"assignment",
"exists",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L484-L494 |
131,858 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.retryWithCleanup | private <T> CompletableFuture<T> retryWithCleanup(Supplier<CompletableFuture<T>> toTry) {
CompletableFuture<T> result = new CompletableFuture<>();
toTry.get()
.thenAccept(result::complete)
.exceptionally(ex -> {
// Check if the exception indicates the Metadata ... | java | private <T> CompletableFuture<T> retryWithCleanup(Supplier<CompletableFuture<T>> toTry) {
CompletableFuture<T> result = new CompletableFuture<>();
toTry.get()
.thenAccept(result::complete)
.exceptionally(ex -> {
// Check if the exception indicates the Metadata ... | [
"private",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"retryWithCleanup",
"(",
"Supplier",
"<",
"CompletableFuture",
"<",
"T",
">",
">",
"toTry",
")",
"{",
"CompletableFuture",
"<",
"T",
">",
"result",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")... | Retries Future from the given supplier exactly once if encountering TooManyActiveSegmentsException.
@param toTry A Supplier that returns a Future to execute. This will be invoked either once or twice.
@param <T> Return type of Future.
@return A CompletableFuture with the result, or failure cause. | [
"Retries",
"Future",
"from",
"the",
"given",
"supplier",
"exactly",
"once",
"if",
"encountering",
"TooManyActiveSegmentsException",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L507-L534 |
131,859 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.createScope | @Override
public void createScope(final CreateScopeRequest createScopeRequest, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "createScope");
try {
NameUtils.validateUserScopeName(create... | java | @Override
public void createScope(final CreateScopeRequest createScopeRequest, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "createScope");
try {
NameUtils.validateUserScopeName(create... | [
"@",
"Override",
"public",
"void",
"createScope",
"(",
"final",
"CreateScopeRequest",
"createScopeRequest",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
"asyncResponse",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"tra... | Implementation of createScope REST API.
@param createScopeRequest The object conforming to createScope request json.
@param securityContext The security for API access.
@param asyncResponse AsyncResponse provides means for asynchronous server side response processing. | [
"Implementation",
"of",
"createScope",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L92-L132 |
131,860 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.deleteScope | @Override
public void deleteScope(final String scopeName, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "deleteScope");
try {
restAuthHelper.authenticateAuthorize(getAuthorizationHeader(),
... | java | @Override
public void deleteScope(final String scopeName, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "deleteScope");
try {
restAuthHelper.authenticateAuthorize(getAuthorizationHeader(),
... | [
"@",
"Override",
"public",
"void",
"deleteScope",
"(",
"final",
"String",
"scopeName",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
"asyncResponse",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnter",
"(",
"l... | Implementation of deleteScope REST API.
@param scopeName The scope name of stream.
@param securityContext The security for API access.
@param asyncResponse AsyncResponse provides means for asynchronous server side response processing. | [
"Implementation",
"of",
"deleteScope",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L214-L248 |
131,861 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.deleteStream | @Override
public void deleteStream(final String scopeName, final String streamName, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "deleteStream");
try {
restAuthHelper.authenticateAuthorize(
... | java | @Override
public void deleteStream(final String scopeName, final String streamName, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "deleteStream");
try {
restAuthHelper.authenticateAuthorize(
... | [
"@",
"Override",
"public",
"void",
"deleteStream",
"(",
"final",
"String",
"scopeName",
",",
"final",
"String",
"streamName",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
"asyncResponse",
")",
"{",
"long",
"traceId",
"=",
"Log... | Implementation of deleteStream REST API.
@param scopeName The scope name of stream.
@param streamName The name of stream.
@param securityContext The security for API access.
@param asyncResponse AsyncResponse provides means for asynchronous server side response processing. | [
"Implementation",
"of",
"deleteStream",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L258-L294 |
131,862 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.getScope | @Override
public void getScope(final String scopeName, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "getScope");
try {
restAuthHelper.authenticateAuthorize(
getAuthor... | java | @Override
public void getScope(final String scopeName, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "getScope");
try {
restAuthHelper.authenticateAuthorize(
getAuthor... | [
"@",
"Override",
"public",
"void",
"getScope",
"(",
"final",
"String",
"scopeName",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
"asyncResponse",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnter",
"(",
"log"... | Implementation of getScope REST API.
@param scopeName Scope Name.
@param securityContext The security for API access.
@param asyncResponse AsyncResponse provides means for asynchronous server side response processing. | [
"Implementation",
"of",
"getScope",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L346-L376 |
131,863 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.listScopes | @Override
public void listScopes(final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "listScopes");
final Principal principal;
final List<String> authHeader = getAuthorizationHeader();
try {
principal ... | java | @Override
public void listScopes(final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "listScopes");
final Principal principal;
final List<String> authHeader = getAuthorizationHeader();
try {
principal ... | [
"@",
"Override",
"public",
"void",
"listScopes",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
"asyncResponse",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnter",
"(",
"log",
",",
"\"listScopes\"",
")",
";",
... | Implementation of listScopes REST API.
@param securityContext The security for API access.
@param asyncResponse AsyncResponse provides means for asynchronous server side response processing. | [
"Implementation",
"of",
"listScopes",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L466-L509 |
131,864 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.listStreams | @Override
public void listStreams(final String scopeName, final String showInternalStreams,
final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "listStreams");
final Principal principal;
final L... | java | @Override
public void listStreams(final String scopeName, final String showInternalStreams,
final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "listStreams");
final Principal principal;
final L... | [
"@",
"Override",
"public",
"void",
"listStreams",
"(",
"final",
"String",
"scopeName",
",",
"final",
"String",
"showInternalStreams",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
"asyncResponse",
")",
"{",
"long",
"traceId",
"="... | Implementation of listStreams REST API.
@param scopeName The scope name of stream.
@param securityContext The security for API access.
@param asyncResponse AsyncResponse provides means for asynchronous server side response processing. | [
"Implementation",
"of",
"listStreams",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L518-L571 |
131,865 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.updateStream | @Override
public void updateStream(final String scopeName, final String streamName,
final UpdateStreamRequest updateStreamRequest, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "updateStream");
try {
... | java | @Override
public void updateStream(final String scopeName, final String streamName,
final UpdateStreamRequest updateStreamRequest, final SecurityContext securityContext,
final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "updateStream");
try {
... | [
"@",
"Override",
"public",
"void",
"updateStream",
"(",
"final",
"String",
"scopeName",
",",
"final",
"String",
"streamName",
",",
"final",
"UpdateStreamRequest",
"updateStreamRequest",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncResponse",
... | Implementation of updateStream REST API.
@param scopeName The scope name of stream.
@param streamName The name of stream.
@param updateStreamRequest The object conforming to updateStreamConfig request json.
@param securityContext The security for API access.
@param asyncResponse AsyncRespo... | [
"Implementation",
"of",
"updateStream",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L582-L619 |
131,866 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.updateStreamState | @Override
public void updateStreamState(final String scopeName, final String streamName,
final StreamState updateStreamStateRequest, SecurityContext securityContext, AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "updateStreamState");
try {
restA... | java | @Override
public void updateStreamState(final String scopeName, final String streamName,
final StreamState updateStreamStateRequest, SecurityContext securityContext, AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "updateStreamState");
try {
restA... | [
"@",
"Override",
"public",
"void",
"updateStreamState",
"(",
"final",
"String",
"scopeName",
",",
"final",
"String",
"streamName",
",",
"final",
"StreamState",
"updateStreamStateRequest",
",",
"SecurityContext",
"securityContext",
",",
"AsyncResponse",
"asyncResponse",
... | Implementation of updateStreamState REST API.
@param scopeName The scope name of stream.
@param streamName The name of stream.
@param updateStreamStateRequest The object conforming to updateStreamStateRequest request json.
@param securityContext The security for API access.
@p... | [
"Implementation",
"of",
"updateStreamState",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L630-L671 |
131,867 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java | StreamMetadataResourceImpl.getScalingEvents | @Override
public void getScalingEvents(final String scopeName, final String streamName, final Long from, final Long to,
final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "getScalingEvents");
try ... | java | @Override
public void getScalingEvents(final String scopeName, final String streamName, final Long from, final Long to,
final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "getScalingEvents");
try ... | [
"@",
"Override",
"public",
"void",
"getScalingEvents",
"(",
"final",
"String",
"scopeName",
",",
"final",
"String",
"streamName",
",",
"final",
"Long",
"from",
",",
"final",
"Long",
"to",
",",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"AsyncRe... | Implementation of getScalingEvents REST API.
@param scopeName The scope name of stream.
@param streamName The name of stream.
@param from DateTime from which scaling events should be displayed.
@param to DateTime until which scaling events should be displayed.
@param security... | [
"Implementation",
"of",
"getScalingEvents",
"REST",
"API",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L683-L741 |
131,868 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.initialize | private void initialize(ByteArraySegment footer, long footerOffset, long indexLength) {
if (footer.getLength() != FOOTER_LENGTH) {
throw new IllegalDataFormatException(String.format("Wrong footer length. Expected %s, actual %s.", FOOTER_LENGTH, footer.getLength()));
}
long rootPageO... | java | private void initialize(ByteArraySegment footer, long footerOffset, long indexLength) {
if (footer.getLength() != FOOTER_LENGTH) {
throw new IllegalDataFormatException(String.format("Wrong footer length. Expected %s, actual %s.", FOOTER_LENGTH, footer.getLength()));
}
long rootPageO... | [
"private",
"void",
"initialize",
"(",
"ByteArraySegment",
"footer",
",",
"long",
"footerOffset",
",",
"long",
"indexLength",
")",
"{",
"if",
"(",
"footer",
".",
"getLength",
"(",
")",
"!=",
"FOOTER_LENGTH",
")",
"{",
"throw",
"new",
"IllegalDataFormatException",... | Initializes the BTreeIndex using information from the given footer.
@param footer A ByteArraySegment representing the footer that was written with the last update.
@param footerOffset The offset within the data source where the footer is located at.
@param indexLength The length of the index, in bytes, in the d... | [
"Initializes",
"the",
"BTreeIndex",
"using",
"information",
"from",
"the",
"given",
"footer",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L207-L220 |
131,869 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.applyUpdates | private CompletableFuture<UpdateablePageCollection> applyUpdates(Iterator<PageEntry> updates, TimeoutTimer timer) {
UpdateablePageCollection pageCollection = new UpdateablePageCollection(this.state.get().length);
AtomicReference<PageWrapper> lastPage = new AtomicReference<>(null);
val lastPageUp... | java | private CompletableFuture<UpdateablePageCollection> applyUpdates(Iterator<PageEntry> updates, TimeoutTimer timer) {
UpdateablePageCollection pageCollection = new UpdateablePageCollection(this.state.get().length);
AtomicReference<PageWrapper> lastPage = new AtomicReference<>(null);
val lastPageUp... | [
"private",
"CompletableFuture",
"<",
"UpdateablePageCollection",
">",
"applyUpdates",
"(",
"Iterator",
"<",
"PageEntry",
">",
"updates",
",",
"TimeoutTimer",
"timer",
")",
"{",
"UpdateablePageCollection",
"pageCollection",
"=",
"new",
"UpdateablePageCollection",
"(",
"t... | Executes the given updates on the index. Loads up any necessary BTreePage instances in memory but does not persist
the changes to the external data source, nor does it reassign offsets to the modified pages, perform splits, etc.
@param updates An Iterator of the PageEntry instances to insert, update or remove. The Ite... | [
"Executes",
"the",
"given",
"updates",
"on",
"the",
"index",
".",
"Loads",
"up",
"any",
"necessary",
"BTreePage",
"instances",
"in",
"memory",
"but",
"does",
"not",
"persist",
"the",
"changes",
"to",
"the",
"external",
"data",
"source",
"nor",
"does",
"it",
... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L327-L365 |
131,870 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.loadSmallestOffsetPage | private CompletableFuture<?> loadSmallestOffsetPage(PageCollection pageCollection, TimeoutTimer timer) {
if (pageCollection.getCount() <= 1) {
// We only modified at most one page. This means have at most one page in the index, so no point in re-loading it.
return CompletableFuture.compl... | java | private CompletableFuture<?> loadSmallestOffsetPage(PageCollection pageCollection, TimeoutTimer timer) {
if (pageCollection.getCount() <= 1) {
// We only modified at most one page. This means have at most one page in the index, so no point in re-loading it.
return CompletableFuture.compl... | [
"private",
"CompletableFuture",
"<",
"?",
">",
"loadSmallestOffsetPage",
"(",
"PageCollection",
"pageCollection",
",",
"TimeoutTimer",
"timer",
")",
"{",
"if",
"(",
"pageCollection",
".",
"getCount",
"(",
")",
"<=",
"1",
")",
"{",
"// We only modified at most one pa... | Loads the BTreePage with the smallest offset from the DataSource. The purpose of this is for incremental compaction.
The page with the smallest offset will be moved to the end of the index, which allows the external data source to
perform any truncation necessary in order to free up space.
@param pageCollection A Page... | [
"Loads",
"the",
"BTreePage",
"with",
"the",
"smallest",
"offset",
"from",
"the",
"DataSource",
".",
"The",
"purpose",
"of",
"this",
"is",
"for",
"incremental",
"compaction",
".",
"The",
"page",
"with",
"the",
"smallest",
"offset",
"will",
"be",
"moved",
"to"... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L377-L389 |
131,871 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.processSplitPage | private void processSplitPage(List<BTreePage> splitResult, PageModificationContext context) {
PageWrapper originalPage = context.getPageWrapper();
for (int i = 0; i < splitResult.size(); i++) {
val page = splitResult.get(i);
ByteArraySegment newPageKey;
long newOffset... | java | private void processSplitPage(List<BTreePage> splitResult, PageModificationContext context) {
PageWrapper originalPage = context.getPageWrapper();
for (int i = 0; i < splitResult.size(); i++) {
val page = splitResult.get(i);
ByteArraySegment newPageKey;
long newOffset... | [
"private",
"void",
"processSplitPage",
"(",
"List",
"<",
"BTreePage",
">",
"splitResult",
",",
"PageModificationContext",
"context",
")",
"{",
"PageWrapper",
"originalPage",
"=",
"context",
".",
"getPageWrapper",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0"... | Processes a Page Split result. The first split page will replace the existing page, while the remaining pages
will need to be inserted as children into the parent.
@param splitResult The result of the original BTreePage's splitIfNecessary() call.
@param context Processing context. | [
"Processes",
"a",
"Page",
"Split",
"result",
".",
"The",
"first",
"split",
"page",
"will",
"replace",
"the",
"existing",
"page",
"while",
"the",
"remaining",
"pages",
"will",
"need",
"to",
"be",
"inserted",
"as",
"children",
"into",
"the",
"parent",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L469-L500 |
131,872 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.calculateMinOffset | private long calculateMinOffset(PageWrapper pageWrapper) {
// Minimum within {PageOffset, All PagePointers' MinLength fields}.
long min = pageWrapper.getOffset();
if (!pageWrapper.isIndexPage()) {
// Leaf pages do not have PagePointers, so the result is their actual offsets.
... | java | private long calculateMinOffset(PageWrapper pageWrapper) {
// Minimum within {PageOffset, All PagePointers' MinLength fields}.
long min = pageWrapper.getOffset();
if (!pageWrapper.isIndexPage()) {
// Leaf pages do not have PagePointers, so the result is their actual offsets.
... | [
"private",
"long",
"calculateMinOffset",
"(",
"PageWrapper",
"pageWrapper",
")",
"{",
"// Minimum within {PageOffset, All PagePointers' MinLength fields}.",
"long",
"min",
"=",
"pageWrapper",
".",
"getOffset",
"(",
")",
";",
"if",
"(",
"!",
"pageWrapper",
".",
"isIndexP... | Calculates the Minimum Page Offset for this PageWrapper.
The Minimum Page Offset is the smallest of this PageWrapper's offset and the MinOffsets of all this PageWrapper's
direct children.
@param pageWrapper The PageWrapper to calculate the Minimum Page Offset for.
@return The result. | [
"Calculates",
"the",
"Minimum",
"Page",
"Offset",
"for",
"this",
"PageWrapper",
".",
"The",
"Minimum",
"Page",
"Offset",
"is",
"the",
"smallest",
"of",
"this",
"PageWrapper",
"s",
"offset",
"and",
"the",
"MinOffsets",
"of",
"all",
"this",
"PageWrapper",
"s",
... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L538-L554 |
131,873 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.locatePage | private CompletableFuture<PageWrapper> locatePage(ByteArraySegment key, PageCollection pageCollection, TimeoutTimer timer) {
// Verify the sought key has the expected length.
Preconditions.checkArgument(key.getLength() == this.leafPageConfig.getKeyLength(), "Invalid key length.");
// Sanity che... | java | private CompletableFuture<PageWrapper> locatePage(ByteArraySegment key, PageCollection pageCollection, TimeoutTimer timer) {
// Verify the sought key has the expected length.
Preconditions.checkArgument(key.getLength() == this.leafPageConfig.getKeyLength(), "Invalid key length.");
// Sanity che... | [
"private",
"CompletableFuture",
"<",
"PageWrapper",
">",
"locatePage",
"(",
"ByteArraySegment",
"key",
",",
"PageCollection",
"pageCollection",
",",
"TimeoutTimer",
"timer",
")",
"{",
"// Verify the sought key has the expected length.",
"Preconditions",
".",
"checkArgument",
... | Locates the Leaf Page that contains or should contain the given Key.
@param key A ByteArraySegment that represents the Key to look up the Leaf Page for.
@param pageCollection A PageCollection that contains already looked-up pages. Any newly looked up pages will be
inserted in this instance as well.
@param t... | [
"Locates",
"the",
"Leaf",
"Page",
"that",
"contains",
"or",
"should",
"contain",
"the",
"given",
"Key",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L586-L602 |
131,874 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.locatePage | private CompletableFuture<PageWrapper> locatePage(Function<BTreePage, PagePointer> getChildPointer, Predicate<PageWrapper> found,
PageCollection pageCollection, TimeoutTimer timer) {
AtomicReference<PagePointer> pagePointer = new AtomicReference<>(new PagePo... | java | private CompletableFuture<PageWrapper> locatePage(Function<BTreePage, PagePointer> getChildPointer, Predicate<PageWrapper> found,
PageCollection pageCollection, TimeoutTimer timer) {
AtomicReference<PagePointer> pagePointer = new AtomicReference<>(new PagePo... | [
"private",
"CompletableFuture",
"<",
"PageWrapper",
">",
"locatePage",
"(",
"Function",
"<",
"BTreePage",
",",
"PagePointer",
">",
"getChildPointer",
",",
"Predicate",
"<",
"PageWrapper",
">",
"found",
",",
"PageCollection",
"pageCollection",
",",
"TimeoutTimer",
"t... | Locates the BTreePage according to the given criteria.
@param getChildPointer A Function that, when applied to a BTreePage, will return a PagePointer which can be used
to load up the next page.
@param found A Predicate that, when applied to a PageWrapper, will indicate if this is the sought page.
@param page... | [
"Locates",
"the",
"BTreePage",
"according",
"to",
"the",
"given",
"criteria",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L614-L639 |
131,875 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.fetchPage | private CompletableFuture<PageWrapper> fetchPage(PagePointer pagePointer, PageWrapper parentPage, PageCollection pageCollection, Duration timeout) {
PageWrapper fromCache = pageCollection.get(pagePointer.getOffset());
if (fromCache != null) {
return CompletableFuture.completedFuture(fromCach... | java | private CompletableFuture<PageWrapper> fetchPage(PagePointer pagePointer, PageWrapper parentPage, PageCollection pageCollection, Duration timeout) {
PageWrapper fromCache = pageCollection.get(pagePointer.getOffset());
if (fromCache != null) {
return CompletableFuture.completedFuture(fromCach... | [
"private",
"CompletableFuture",
"<",
"PageWrapper",
">",
"fetchPage",
"(",
"PagePointer",
"pagePointer",
",",
"PageWrapper",
"parentPage",
",",
"PageCollection",
"pageCollection",
",",
"Duration",
"timeout",
")",
"{",
"PageWrapper",
"fromCache",
"=",
"pageCollection",
... | Loads up a single Page.
@param pagePointer A PagePointer indicating the Page to load.
@param parentPage The sought page's Parent Page. May be null for root pages only.
@param pageCollection A PageCollection that contains already looked up pages. If the sought page is already loaded
it will be served from here; ... | [
"Loads",
"up",
"a",
"single",
"Page",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L651-L667 |
131,876 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.readPage | private CompletableFuture<ByteArraySegment> readPage(long offset, int length, Duration timeout) {
return this.read.apply(offset, length, timeout);
} | java | private CompletableFuture<ByteArraySegment> readPage(long offset, int length, Duration timeout) {
return this.read.apply(offset, length, timeout);
} | [
"private",
"CompletableFuture",
"<",
"ByteArraySegment",
">",
"readPage",
"(",
"long",
"offset",
",",
"int",
"length",
",",
"Duration",
"timeout",
")",
"{",
"return",
"this",
".",
"read",
".",
"apply",
"(",
"offset",
",",
"length",
",",
"timeout",
")",
";"... | Reads the contents of a single page from the external data source.
@param offset Page offset.
@param length Page length.
@param timeout Timeout for the operation.
@return A CompletableFuture with a ByteArraySegment representing the contents of the page. | [
"Reads",
"the",
"contents",
"of",
"a",
"single",
"page",
"from",
"the",
"external",
"data",
"source",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L738-L740 |
131,877 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.writePages | private CompletableFuture<Long> writePages(UpdateablePageCollection pageCollection, Duration timeout) {
IndexState state = this.state.get();
Preconditions.checkState(state != null, "Cannot write without fetching the state first.");
// Collect the data to be written.
val pages = new Arra... | java | private CompletableFuture<Long> writePages(UpdateablePageCollection pageCollection, Duration timeout) {
IndexState state = this.state.get();
Preconditions.checkState(state != null, "Cannot write without fetching the state first.");
// Collect the data to be written.
val pages = new Arra... | [
"private",
"CompletableFuture",
"<",
"Long",
">",
"writePages",
"(",
"UpdateablePageCollection",
"pageCollection",
",",
"Duration",
"timeout",
")",
"{",
"IndexState",
"state",
"=",
"this",
".",
"state",
".",
"get",
"(",
")",
";",
"Preconditions",
".",
"checkStat... | Writes the contents of all the BTreePages in the given PageCollection to the external data source.
@param pageCollection UpdateablePageCollection with pages.
@param timeout Timeout for the operation.
@return A CompletableFuture with a Long representing the current length of the index in the external data source... | [
"Writes",
"the",
"contents",
"of",
"all",
"the",
"BTreePages",
"in",
"the",
"given",
"PageCollection",
"to",
"the",
"external",
"data",
"source",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L749-L794 |
131,878 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.formatHeaderAndFooter | private void formatHeaderAndFooter(int itemCount, int id) {
// Header.
this.header.set(VERSION_OFFSET, CURRENT_VERSION);
this.header.set(FLAGS_OFFSET, getFlags(this.config.isIndexPage ? FLAG_INDEX_PAGE : FLAG_NONE));
setHeaderId(id);
setCount(itemCount);
// Matching foot... | java | private void formatHeaderAndFooter(int itemCount, int id) {
// Header.
this.header.set(VERSION_OFFSET, CURRENT_VERSION);
this.header.set(FLAGS_OFFSET, getFlags(this.config.isIndexPage ? FLAG_INDEX_PAGE : FLAG_NONE));
setHeaderId(id);
setCount(itemCount);
// Matching foot... | [
"private",
"void",
"formatHeaderAndFooter",
"(",
"int",
"itemCount",
",",
"int",
"id",
")",
"{",
"// Header.",
"this",
".",
"header",
".",
"set",
"(",
"VERSION_OFFSET",
",",
"CURRENT_VERSION",
")",
";",
"this",
".",
"header",
".",
"set",
"(",
"FLAGS_OFFSET",... | Formats the Header and Footer of this BTreePage with the given information.
@param itemCount The number of items in this BTreePage.
@param id The Id of this BTreePage. | [
"Formats",
"the",
"Header",
"and",
"Footer",
"of",
"this",
"BTreePage",
"with",
"the",
"given",
"information",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L202-L211 |
131,879 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.getValueAt | ByteArraySegment getValueAt(int pos) {
Preconditions.checkElementIndex(pos, getCount(), "pos must be non-negative and smaller than the number of items.");
return this.data.subSegment(pos * this.config.entryLength + this.config.keyLength, this.config.valueLength);
} | java | ByteArraySegment getValueAt(int pos) {
Preconditions.checkElementIndex(pos, getCount(), "pos must be non-negative and smaller than the number of items.");
return this.data.subSegment(pos * this.config.entryLength + this.config.keyLength, this.config.valueLength);
} | [
"ByteArraySegment",
"getValueAt",
"(",
"int",
"pos",
")",
"{",
"Preconditions",
".",
"checkElementIndex",
"(",
"pos",
",",
"getCount",
"(",
")",
",",
"\"pos must be non-negative and smaller than the number of items.\"",
")",
";",
"return",
"this",
".",
"data",
".",
... | Gets a ByteArraySegment representing the value at the given Position.
@param pos The position to get the value at.
@return A ByteArraySegment containing the value at the given Position. Note that this is a view inside a larger array
and any modifications to that array will be reflected in this. If this value needs to ... | [
"Gets",
"a",
"ByteArraySegment",
"representing",
"the",
"value",
"at",
"the",
"given",
"Position",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L253-L256 |
131,880 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.getKeyAt | ByteArraySegment getKeyAt(int pos) {
Preconditions.checkElementIndex(pos, getCount(), "pos must be non-negative and smaller than the number of items.");
return this.data.subSegment(pos * this.config.entryLength, this.config.keyLength);
} | java | ByteArraySegment getKeyAt(int pos) {
Preconditions.checkElementIndex(pos, getCount(), "pos must be non-negative and smaller than the number of items.");
return this.data.subSegment(pos * this.config.entryLength, this.config.keyLength);
} | [
"ByteArraySegment",
"getKeyAt",
"(",
"int",
"pos",
")",
"{",
"Preconditions",
".",
"checkElementIndex",
"(",
"pos",
",",
"getCount",
"(",
")",
",",
"\"pos must be non-negative and smaller than the number of items.\"",
")",
";",
"return",
"this",
".",
"data",
".",
"s... | Gets the Key at the given Position.
@param pos The Position to get the Key at.
@return A ByteArraySegment containing the Key at the given Position. Note that this is a view inside a larger array
and any modifications to that array will be reflected in this. If this value needs to be held for
longer then it is recommen... | [
"Gets",
"the",
"Key",
"at",
"the",
"given",
"Position",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L266-L269 |
131,881 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.setFirstKey | void setFirstKey(ByteArraySegment newKey) {
Preconditions.checkState(getCount() > 0, "BTreePage is empty. Cannot set first key.");
Preconditions.checkArgument(newKey.getLength() == this.config.getKeyLength(), "Incorrect key length.");
Preconditions.checkArgument(KEY_COMPARATOR.compare(newKey, ge... | java | void setFirstKey(ByteArraySegment newKey) {
Preconditions.checkState(getCount() > 0, "BTreePage is empty. Cannot set first key.");
Preconditions.checkArgument(newKey.getLength() == this.config.getKeyLength(), "Incorrect key length.");
Preconditions.checkArgument(KEY_COMPARATOR.compare(newKey, ge... | [
"void",
"setFirstKey",
"(",
"ByteArraySegment",
"newKey",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"getCount",
"(",
")",
">",
"0",
",",
"\"BTreePage is empty. Cannot set first key.\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"newKey",
".",
... | Updates the first PageEntry's key to the given value.
@param newKey A ByteArraySegment representing the replacement value for the first key. This must be smaller than
or equal to the current value of the first key (using KEY_COMPARATOR). | [
"Updates",
"the",
"first",
"PageEntry",
"s",
"key",
"to",
"the",
"given",
"value",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L277-L284 |
131,882 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.getEntries | List<PageEntry> getEntries(int firstIndex, int lastIndex) {
Preconditions.checkArgument(firstIndex <= lastIndex, "firstIndex must be smaller than or equal to lastIndex.");
ArrayList<PageEntry> result = new ArrayList<>();
for (int i = firstIndex; i <= lastIndex; i++) {
result.add(getE... | java | List<PageEntry> getEntries(int firstIndex, int lastIndex) {
Preconditions.checkArgument(firstIndex <= lastIndex, "firstIndex must be smaller than or equal to lastIndex.");
ArrayList<PageEntry> result = new ArrayList<>();
for (int i = firstIndex; i <= lastIndex; i++) {
result.add(getE... | [
"List",
"<",
"PageEntry",
">",
"getEntries",
"(",
"int",
"firstIndex",
",",
"int",
"lastIndex",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"firstIndex",
"<=",
"lastIndex",
",",
"\"firstIndex must be smaller than or equal to lastIndex.\"",
")",
";",
"ArrayLi... | Gets all the Page Entries between the two indices.
@param firstIndex The first index to get Page Entries from (inclusive).
@param lastIndex The last index to get Page Entries to (inclusive).
@return A new List containing the desired result. | [
"Gets",
"all",
"the",
"Page",
"Entries",
"between",
"the",
"two",
"indices",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L308-L316 |
131,883 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.applyInsertsAndRemovals | private BTreePage applyInsertsAndRemovals(ChangeInfo ci) {
int newCount = getCount() + ci.insertCount - ci.deleteCount;
// Allocate new buffer of the correct size and start copying from the old one.
val newPage = new BTreePage(this.config, new ByteArraySegment(new byte[DATA_OFFSET + newCount * ... | java | private BTreePage applyInsertsAndRemovals(ChangeInfo ci) {
int newCount = getCount() + ci.insertCount - ci.deleteCount;
// Allocate new buffer of the correct size and start copying from the old one.
val newPage = new BTreePage(this.config, new ByteArraySegment(new byte[DATA_OFFSET + newCount * ... | [
"private",
"BTreePage",
"applyInsertsAndRemovals",
"(",
"ChangeInfo",
"ci",
")",
"{",
"int",
"newCount",
"=",
"getCount",
"(",
")",
"+",
"ci",
".",
"insertCount",
"-",
"ci",
".",
"deleteCount",
";",
"// Allocate new buffer of the correct size and start copying from the ... | Inserts the new PageEntry instances at the given offsets.
@param ci A {@link ChangeInfo} object containing information to change.
@return A new BTreePage instance with the updated contents. | [
"Inserts",
"the",
"new",
"PageEntry",
"instances",
"at",
"the",
"given",
"offsets",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L515-L554 |
131,884 | pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreePage.java | BTreePage.setValueAtPosition | private void setValueAtPosition(int pos, ByteArraySegment value) {
Preconditions.checkElementIndex(pos, getCount(), "pos must be non-negative and smaller than the number of items.");
Preconditions.checkArgument(value.getLength() == this.config.valueLength, "Given value has incorrect length.");
t... | java | private void setValueAtPosition(int pos, ByteArraySegment value) {
Preconditions.checkElementIndex(pos, getCount(), "pos must be non-negative and smaller than the number of items.");
Preconditions.checkArgument(value.getLength() == this.config.valueLength, "Given value has incorrect length.");
t... | [
"private",
"void",
"setValueAtPosition",
"(",
"int",
"pos",
",",
"ByteArraySegment",
"value",
")",
"{",
"Preconditions",
".",
"checkElementIndex",
"(",
"pos",
",",
"getCount",
"(",
")",
",",
"\"pos must be non-negative and smaller than the number of items.\"",
")",
";",... | Sets the Value at the given position.
@param pos The Position to set the value at.
@param value A ByteArraySegment representing the value to set. | [
"Sets",
"the",
"Value",
"at",
"the",
"given",
"position",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreePage.java#L573-L577 |
131,885 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DurableLog.java | DurableLog.add | @Override
public CompletableFuture<Void> add(Operation operation, Duration timeout) {
ensureRunning();
return this.operationProcessor.process(operation);
} | java | @Override
public CompletableFuture<Void> add(Operation operation, Duration timeout) {
ensureRunning();
return this.operationProcessor.process(operation);
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"Void",
">",
"add",
"(",
"Operation",
"operation",
",",
"Duration",
"timeout",
")",
"{",
"ensureRunning",
"(",
")",
";",
"return",
"this",
".",
"operationProcessor",
".",
"process",
"(",
"operation",
")",
... | region OperationLog Implementation | [
"region",
"OperationLog",
"Implementation"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/DurableLog.java#L293-L297 |
131,886 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/operations/StreamSegmentMapOperation.java | StreamSegmentMapOperation.setStreamSegmentId | public void setStreamSegmentId(long value) {
Preconditions.checkState(this.streamSegmentId == ContainerMetadata.NO_STREAM_SEGMENT_ID, "StreamSegmentId has already been assigned for this operation.");
Preconditions.checkArgument(value != ContainerMetadata.NO_STREAM_SEGMENT_ID, "Invalid StreamSegmentId");... | java | public void setStreamSegmentId(long value) {
Preconditions.checkState(this.streamSegmentId == ContainerMetadata.NO_STREAM_SEGMENT_ID, "StreamSegmentId has already been assigned for this operation.");
Preconditions.checkArgument(value != ContainerMetadata.NO_STREAM_SEGMENT_ID, "Invalid StreamSegmentId");... | [
"public",
"void",
"setStreamSegmentId",
"(",
"long",
"value",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"streamSegmentId",
"==",
"ContainerMetadata",
".",
"NO_STREAM_SEGMENT_ID",
",",
"\"StreamSegmentId has already been assigned for this operation.\"",
... | Sets the StreamSegmentId for this operation.
@param value The Id of the segment to set. | [
"Sets",
"the",
"StreamSegmentId",
"for",
"this",
"operation",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/operations/StreamSegmentMapOperation.java#L85-L89 |
131,887 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rpc/auth/PravegaAuthManager.java | PravegaAuthManager.authenticateAndAuthorize | public boolean authenticateAndAuthorize(String resource, String credentials, AuthHandler.Permissions level) throws AuthenticationException {
Preconditions.checkNotNull(credentials, "credentials");
boolean retVal = false;
try {
String[] parts = extractMethodAndToken(credentials);
... | java | public boolean authenticateAndAuthorize(String resource, String credentials, AuthHandler.Permissions level) throws AuthenticationException {
Preconditions.checkNotNull(credentials, "credentials");
boolean retVal = false;
try {
String[] parts = extractMethodAndToken(credentials);
... | [
"public",
"boolean",
"authenticateAndAuthorize",
"(",
"String",
"resource",
",",
"String",
"credentials",
",",
"AuthHandler",
".",
"Permissions",
"level",
")",
"throws",
"AuthenticationException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"credentials",
",",
"\"... | API to authenticate and authorize access to a given resource.
@param resource The resource identifier for which the access needs to be controlled.
@param credentials Credentials used for authentication.
@param level Expected level of access.
@return Returns true if the entity represented by the custom auth ... | [
"API",
"to",
"authenticate",
"and",
"authorize",
"access",
"to",
"a",
"given",
"resource",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rpc/auth/PravegaAuthManager.java#L65-L83 |
131,888 | pravega/pravega | controller/src/main/java/io/pravega/controller/server/rpc/auth/PravegaAuthManager.java | PravegaAuthManager.registerInterceptors | public void registerInterceptors(ServerBuilder<?> builder) {
try {
if (serverConfig.isAuthorizationEnabled()) {
ServiceLoader<AuthHandler> loader = ServiceLoader.load(AuthHandler.class);
for (AuthHandler handler : loader) {
try {
... | java | public void registerInterceptors(ServerBuilder<?> builder) {
try {
if (serverConfig.isAuthorizationEnabled()) {
ServiceLoader<AuthHandler> loader = ServiceLoader.load(AuthHandler.class);
for (AuthHandler handler : loader) {
try {
... | [
"public",
"void",
"registerInterceptors",
"(",
"ServerBuilder",
"<",
"?",
">",
"builder",
")",
"{",
"try",
"{",
"if",
"(",
"serverConfig",
".",
"isAuthorizationEnabled",
"(",
")",
")",
"{",
"ServiceLoader",
"<",
"AuthHandler",
">",
"loader",
"=",
"ServiceLoade... | Loads the custom implementations of the AuthHandler interface dynamically. Registers the interceptors with grpc.
Stores the implementation in a local map for routing the REST auth request.
@param builder The grpc service builder to register the interceptors. | [
"Loads",
"the",
"custom",
"implementations",
"of",
"the",
"AuthHandler",
"interface",
"dynamically",
".",
"Registers",
"the",
"interceptors",
"with",
"grpc",
".",
"Stores",
"the",
"implementation",
"in",
"a",
"local",
"map",
"for",
"routing",
"the",
"REST",
"aut... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rpc/auth/PravegaAuthManager.java#L151-L173 |
131,889 | pravega/pravega | common/src/main/java/io/pravega/common/ExponentialMovingAverage.java | ExponentialMovingAverage.addNewSample | public double addNewSample(double newSample) {
final double sample = calculateLog(newSample);
return Double.longBitsToDouble(valueEncodedAsLong.updateAndGet(value -> {
return Double.doubleToRawLongBits(sample * newSampleWeight + (1.0 - newSampleWeight) * Double.longBitsToDouble(value));
... | java | public double addNewSample(double newSample) {
final double sample = calculateLog(newSample);
return Double.longBitsToDouble(valueEncodedAsLong.updateAndGet(value -> {
return Double.doubleToRawLongBits(sample * newSampleWeight + (1.0 - newSampleWeight) * Double.longBitsToDouble(value));
... | [
"public",
"double",
"addNewSample",
"(",
"double",
"newSample",
")",
"{",
"final",
"double",
"sample",
"=",
"calculateLog",
"(",
"newSample",
")",
";",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"valueEncodedAsLong",
".",
"updateAndGet",
"(",
"value",
"->... | Adds a new sample to the moving average and returns the updated value.
@param newSample the new value to be added
@return Double indicating the updated moving average value after adding a new sample. | [
"Adds",
"a",
"new",
"sample",
"to",
"the",
"moving",
"average",
"and",
"returns",
"the",
"updated",
"value",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/ExponentialMovingAverage.java#L57-L62 |
131,890 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java | WriteQueue.getStatistics | synchronized QueueStats getStatistics() {
int size = this.writes.size();
double fillRatio = calculateFillRatio(this.totalLength, size);
int processingTime = this.lastDurationMillis;
if (processingTime == 0 && size > 0) {
// We get in here when this method is invoked prior to ... | java | synchronized QueueStats getStatistics() {
int size = this.writes.size();
double fillRatio = calculateFillRatio(this.totalLength, size);
int processingTime = this.lastDurationMillis;
if (processingTime == 0 && size > 0) {
// We get in here when this method is invoked prior to ... | [
"synchronized",
"QueueStats",
"getStatistics",
"(",
")",
"{",
"int",
"size",
"=",
"this",
".",
"writes",
".",
"size",
"(",
")",
";",
"double",
"fillRatio",
"=",
"calculateFillRatio",
"(",
"this",
".",
"totalLength",
",",
"size",
")",
";",
"int",
"processin... | Gets a snapshot of the queue internals.
@return The snapshot, including Queue Size, Item Fill Rate and elapsed time of the oldest item. | [
"Gets",
"a",
"snapshot",
"of",
"the",
"queue",
"internals",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java#L77-L89 |
131,891 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java | WriteQueue.add | synchronized void add(Write write) {
Exceptions.checkNotClosed(this.closed, this);
this.writes.addLast(write);
this.totalLength += write.data.getLength();
write.setQueueAddedTimestamp(this.timeSupplier.get());
} | java | synchronized void add(Write write) {
Exceptions.checkNotClosed(this.closed, this);
this.writes.addLast(write);
this.totalLength += write.data.getLength();
write.setQueueAddedTimestamp(this.timeSupplier.get());
} | [
"synchronized",
"void",
"add",
"(",
"Write",
"write",
")",
"{",
"Exceptions",
".",
"checkNotClosed",
"(",
"this",
".",
"closed",
",",
"this",
")",
";",
"this",
".",
"writes",
".",
"addLast",
"(",
"write",
")",
";",
"this",
".",
"totalLength",
"+=",
"wr... | Adds a new Write to the end of the queue.
@param write The write to add. | [
"Adds",
"a",
"new",
"Write",
"to",
"the",
"end",
"of",
"the",
"queue",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java#L96-L101 |
131,892 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java | WriteQueue.close | synchronized List<Write> close() {
List<Write> items = new ArrayList<>(this.writes);
this.writes.clear();
this.totalLength = 0;
this.closed = true;
return items;
} | java | synchronized List<Write> close() {
List<Write> items = new ArrayList<>(this.writes);
this.writes.clear();
this.totalLength = 0;
this.closed = true;
return items;
} | [
"synchronized",
"List",
"<",
"Write",
">",
"close",
"(",
")",
"{",
"List",
"<",
"Write",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"this",
".",
"writes",
")",
";",
"this",
".",
"writes",
".",
"clear",
"(",
")",
";",
"this",
".",
"totalLengt... | Clears the queue of all the items and closes it, preventing any new writes from being added.
@return A new List with the contents of the queue (prior to cleanup), in the same order. | [
"Clears",
"the",
"queue",
"of",
"all",
"the",
"items",
"and",
"closes",
"it",
"preventing",
"any",
"new",
"writes",
"from",
"being",
"added",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/WriteQueue.java#L108-L114 |
131,893 | pravega/pravega | shared/metrics/src/main/java/io/pravega/shared/metrics/RegistryConfigUtil.java | RegistryConfigUtil.createStatsDConfig | public static StatsdConfig createStatsDConfig(MetricsConfig conf) {
log.info("Configuring stats with statsD at {}:{}", conf.getStatsDHost(), conf.getStatsDPort());
return new StatsdConfig() {
@Override
public Duration step() {
return Duration.ofSeconds(conf.getOut... | java | public static StatsdConfig createStatsDConfig(MetricsConfig conf) {
log.info("Configuring stats with statsD at {}:{}", conf.getStatsDHost(), conf.getStatsDPort());
return new StatsdConfig() {
@Override
public Duration step() {
return Duration.ofSeconds(conf.getOut... | [
"public",
"static",
"StatsdConfig",
"createStatsDConfig",
"(",
"MetricsConfig",
"conf",
")",
"{",
"log",
".",
"info",
"(",
"\"Configuring stats with statsD at {}:{}\"",
",",
"conf",
".",
"getStatsDHost",
"(",
")",
",",
"conf",
".",
"getStatsDPort",
"(",
")",
")",
... | Create StatsdConfig for StatsD Register.
@param conf the metric config from Pravega.
@return instance of StatsdConfig to be used by StatsD Register. | [
"Create",
"StatsdConfig",
"for",
"StatsD",
"Register",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/metrics/src/main/java/io/pravega/shared/metrics/RegistryConfigUtil.java#L28-L61 |
131,894 | pravega/pravega | shared/metrics/src/main/java/io/pravega/shared/metrics/RegistryConfigUtil.java | RegistryConfigUtil.createInfluxConfig | public static InfluxConfig createInfluxConfig(MetricsConfig conf) {
log.info("Configuring stats with direct InfluxDB at {}", conf.getInfluxDBUri());
return new InfluxConfig() {
@Override
public Duration step() {
return Duration.ofSeconds(conf.getOutputFrequencySec... | java | public static InfluxConfig createInfluxConfig(MetricsConfig conf) {
log.info("Configuring stats with direct InfluxDB at {}", conf.getInfluxDBUri());
return new InfluxConfig() {
@Override
public Duration step() {
return Duration.ofSeconds(conf.getOutputFrequencySec... | [
"public",
"static",
"InfluxConfig",
"createInfluxConfig",
"(",
"MetricsConfig",
"conf",
")",
"{",
"log",
".",
"info",
"(",
"\"Configuring stats with direct InfluxDB at {}\"",
",",
"conf",
".",
"getInfluxDBUri",
"(",
")",
")",
";",
"return",
"new",
"InfluxConfig",
"(... | Create InfluxConfig for InfluxDB Register.
@param conf the metric config from Pravega.
@return instance of InfluxConfig to be used by InfluxDB register. | [
"Create",
"InfluxConfig",
"for",
"InfluxDB",
"Register",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/metrics/src/main/java/io/pravega/shared/metrics/RegistryConfigUtil.java#L69-L112 |
131,895 | pravega/pravega | common/src/main/java/io/pravega/common/io/StreamHelpers.java | StreamHelpers.readAll | public static int readAll(InputStream stream, byte[] target, int startOffset, int maxLength) throws IOException {
Preconditions.checkNotNull(stream, "stream");
Preconditions.checkNotNull(stream, "target");
Preconditions.checkElementIndex(startOffset, target.length, "startOffset");
Except... | java | public static int readAll(InputStream stream, byte[] target, int startOffset, int maxLength) throws IOException {
Preconditions.checkNotNull(stream, "stream");
Preconditions.checkNotNull(stream, "target");
Preconditions.checkElementIndex(startOffset, target.length, "startOffset");
Except... | [
"public",
"static",
"int",
"readAll",
"(",
"InputStream",
"stream",
",",
"byte",
"[",
"]",
"target",
",",
"int",
"startOffset",
",",
"int",
"maxLength",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"stream",
",",
"\"stream\"",
... | Reads at most 'maxLength' bytes from the given input stream, as long as the stream still has data to serve.
@param stream The InputStream to read from.
@param target The target array to write data to.
@param startOffset The offset within the target array to start writing data to.
@param maxLength The maxim... | [
"Reads",
"at",
"most",
"maxLength",
"bytes",
"from",
"the",
"given",
"input",
"stream",
"as",
"long",
"as",
"the",
"stream",
"still",
"has",
"data",
"to",
"serve",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/io/StreamHelpers.java#L32-L50 |
131,896 | pravega/pravega | common/src/main/java/io/pravega/common/io/StreamHelpers.java | StreamHelpers.readAll | public static byte[] readAll(InputStream source, int length) throws IOException {
byte[] ret = new byte[length];
int readBytes = readAll(source, ret, 0, ret.length);
if (readBytes < ret.length) {
throw new EOFException(String.format(
"Was only able to read %d byte... | java | public static byte[] readAll(InputStream source, int length) throws IOException {
byte[] ret = new byte[length];
int readBytes = readAll(source, ret, 0, ret.length);
if (readBytes < ret.length) {
throw new EOFException(String.format(
"Was only able to read %d byte... | [
"public",
"static",
"byte",
"[",
"]",
"readAll",
"(",
"InputStream",
"source",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"ret",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"int",
"readBytes",
"=",
"readAll",
"(",
"sour... | Reads a number of bytes from the given InputStream and returns it as the given byte array.
@param source The InputStream to read.
@param length The number of bytes to read.
@return A byte array containing the contents of the Stream.
@throws IOException If unable to read from the given InputStream. Throws {@link EOFExc... | [
"Reads",
"a",
"number",
"of",
"bytes",
"from",
"the",
"given",
"InputStream",
"and",
"returns",
"it",
"as",
"the",
"given",
"byte",
"array",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/io/StreamHelpers.java#L61-L70 |
131,897 | pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/ZKStream.java | ZKStream.getId | private CompletableFuture<String> getId() {
String id = this.idRef.get();
if (!Strings.isNullOrEmpty(id)) {
return CompletableFuture.completedFuture(id);
} else {
// We will return empty string as id if the position does not exist.
// This can happen if strea... | java | private CompletableFuture<String> getId() {
String id = this.idRef.get();
if (!Strings.isNullOrEmpty(id)) {
return CompletableFuture.completedFuture(id);
} else {
// We will return empty string as id if the position does not exist.
// This can happen if strea... | [
"private",
"CompletableFuture",
"<",
"String",
">",
"getId",
"(",
")",
"{",
"String",
"id",
"=",
"this",
".",
"idRef",
".",
"get",
"(",
")",
";",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"id",
")",
")",
"{",
"return",
"CompletableFuture",
... | Method to retrieve unique Id for the stream. We use streamPosition as the unique id for the stream.
If the id had been previously retrieved then this method simply returns
the previous value else it retrieves the stored stream position from zookeeper.
The id of a stream is fixed for lifecycle of a stream and only chang... | [
"Method",
"to",
"retrieve",
"unique",
"Id",
"for",
"the",
"stream",
".",
"We",
"use",
"streamPosition",
"as",
"the",
"unique",
"id",
"for",
"the",
"stream",
".",
"If",
"the",
"id",
"had",
"been",
"previously",
"retrieved",
"then",
"this",
"method",
"simply... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/ZKStream.java#L690-L706 |
131,898 | pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/WriterFlushResult.java | WriterFlushResult.withFlushResult | public WriterFlushResult withFlushResult(WriterFlushResult flushResult) {
this.flushedBytes.addAndGet(flushResult.flushedBytes.get());
this.mergedBytes.addAndGet(flushResult.mergedBytes.get());
this.flushedAttributes.addAndGet(flushResult.flushedAttributes.get());
return this;
} | java | public WriterFlushResult withFlushResult(WriterFlushResult flushResult) {
this.flushedBytes.addAndGet(flushResult.flushedBytes.get());
this.mergedBytes.addAndGet(flushResult.mergedBytes.get());
this.flushedAttributes.addAndGet(flushResult.flushedAttributes.get());
return this;
} | [
"public",
"WriterFlushResult",
"withFlushResult",
"(",
"WriterFlushResult",
"flushResult",
")",
"{",
"this",
".",
"flushedBytes",
".",
"addAndGet",
"(",
"flushResult",
".",
"flushedBytes",
".",
"get",
"(",
")",
")",
";",
"this",
".",
"mergedBytes",
".",
"addAndG... | Adds the given WriterFlushResult to this one.
@param flushResult The flush result to add.
@return This object. | [
"Adds",
"the",
"given",
"WriterFlushResult",
"to",
"this",
"one",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/WriterFlushResult.java#L75-L80 |
131,899 | pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Write.java | Write.setWriteLedger | void setWriteLedger(WriteLedger writeLedger) {
this.writeLedger.set(writeLedger);
this.entryId.set(Long.MIN_VALUE);
} | java | void setWriteLedger(WriteLedger writeLedger) {
this.writeLedger.set(writeLedger);
this.entryId.set(Long.MIN_VALUE);
} | [
"void",
"setWriteLedger",
"(",
"WriteLedger",
"writeLedger",
")",
"{",
"this",
".",
"writeLedger",
".",
"set",
"(",
"writeLedger",
")",
";",
"this",
".",
"entryId",
".",
"set",
"(",
"Long",
".",
"MIN_VALUE",
")",
";",
"}"
] | Sets the WriteLedger to be associated with this write.
@param writeLedger The WriteLedger to associate. | [
"Sets",
"the",
"WriteLedger",
"to",
"be",
"associated",
"with",
"this",
"write",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Write.java#L80-L83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.