name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
pulsar_SimpleLoadManagerImpl_m2_rdh
/** * Rank brokers by available capacity, or load percentage, based on placement strategy: * * - Available capacity for weighted random selection (weightedRandomSelection): ranks ResourceUnits units based on * estimation of their capacity which is basically how many bundles each ResourceUnit is able can handle with...
3.26
pulsar_NettyChannelUtil_writeAndFlushWithClosePromise_rdh
/** * Write and flush the message to the channel and the close the channel. * * This method is particularly helpful when the connection is in an invalid state * and therefore a new connection must be created to continue. * * @param ctx * channel's context * @param msg * buffer to write in the channel */ p...
3.26
pulsar_NettyChannelUtil_writeAndFlushWithVoidPromise_rdh
/** * Write and flush the message to the channel. * * The promise is an instance of {@link VoidChannelPromise} that properly propagates exceptions up to the pipeline. * Netty has many ad-hoc optimization if the promise is an instance of {@link VoidChannelPromise}. * Lastly, it reduces pollution of useless {@link i...
3.26
pulsar_GrowableArrayBlockingQueue_terminate_rdh
/** * Make the queue not accept new items. if there are still new data trying to enter the queue, it will be handed * by {@param itemAfterTerminatedHandler}. */ public void terminate(@Nullable Consumer<T> itemAfterTerminatedHandler) { // After wait for the in-flight item enqueue, it means the operation of terminate ...
3.26
pulsar_ConsumerInterceptors_onAcknowledge_rdh
/** * This is called when acknowledge request return from the broker. * <p> * This method calls {@link ConsumerInterceptor#onAcknowledge(Consumer, MessageId, Throwable)} method for each * interceptor. * <p> * This method does not throw exceptions. Exceptions...
3.26
pulsar_ConsumerInterceptors_onNegativeAcksSend_rdh
/** * This is called when a redelivery from a negative acknowledge occurs. * <p> * This method calls {@link ConsumerInterceptor#onNegativeAcksSend(Consumer, Set) * onNegativeAcksSend(Consumer, Set&lt;MessageId&gt;)} method for each interceptor. * <p> * This method does not throw exceptions. Exceptions thrown by a...
3.26
pulsar_ConsumerInterceptors_onAcknowledgeCumulative_rdh
/** * This is called when acknowledge cumulative request return from the broker. * <p> * This method calls {@link ConsumerInterceptor#onAcknowledgeCumulative(Consumer, MessageId, Throwable)} method * for each interceptor. * <p> * This method does not throw exceptions. Exceptions thrown...
3.26
pulsar_ConsumerInterceptors_onAckTimeoutSend_rdh
/** * This is called when a redelivery from an acknowledge timeout occurs. * <p> * This method calls {@link ConsumerInterceptor#onAckTimeoutSend(Consumer, Set) * onAckTimeoutSend(Consumer, Set&lt;MessageId&gt;)} method for each interceptor. * <p> * This method does not throw exceptions. Exceptions thrown by any o...
3.26
pulsar_ConsumerInterceptors_m0_rdh
/** * This is called just before the message is returned by {@link Consumer#receive()}, * {@link MessageListener#received(Consumer, Message)} or the {@link java.util.concurrent.CompletableFuture} * returned by {@link Consumer#receiveAsync()} completes. * <p> * This method calls {@link ConsumerInterceptor#beforeCon...
3.26
pulsar_MessageIdImpl_m0_rdh
// batchIndex is -1 if message is non-batched message and has the batchIndex for a batch message protected byte[] m0(int batchIndex, int batchSize) { MessageIdData msgId = writeMessageIdData(null, batchIndex, batchSize); int size = msgId.getSerializedSize(); ByteBuf serialized = Unpooled.buffer(size, size); msgId.write...
3.26
pulsar_AbstractReplicator_startProducer_rdh
// This method needs to be synchronized with disconnects else if there is a disconnect followed by startProducer // the end result can be disconnect. public synchronized void startProducer() { if (STATE_UPDATER.get(this) == State.Stopping) { long waitTimeMs = backOff.next(); if (log.isDebugEnabled(...
3.26
pulsar_AbstractReplicator_validatePartitionedTopicAsync_rdh
/** * Replication can't be started on root-partitioned-topic to avoid producer startup conflict. * * <pre> * eg: * if topic : persistent://prop/cluster/ns/my-topic is a partitioned topic with 2 partitions then * broker explicitly creates replicator producer for: "my-topic-partition-1" and "my-topic-partition-2". ...
3.26
pulsar_MessagePayload_release_rdh
/** * Release the resources if necessary. * * NOTE: For a MessagePayload object that is created from {@link MessagePayloadFactory#DEFAULT}, this method must be * called to avoid memory leak. */ default void release() { // No ops }
3.26
pulsar_ManagedLedger_skipNonRecoverableLedger_rdh
/** * If a ledger is lost, this ledger will be skipped after enabled "autoSkipNonRecoverableData", and the method is * used to delete information about this ledger in the ManagedCursor. */ default void skipNonRecoverableLedger(long ledgerId) { }
3.26
pulsar_ResourceLockImpl_acquireWithNoRevalidation_rdh
// Simple operation of acquiring the lock with no retries, or checking for the lock content private CompletableFuture<Void> acquireWithNoRevalidation(T newValue) { if (log.isDebugEnabled()) { log.debug("acquireWithNoRevalidation,newValue={},version={}", newValue, version); } ...
3.26
pulsar_ResourceLockImpl_silentRevalidateOnce_rdh
/** * Revalidate the distributed lock if it is not released. * This method is thread-safe and it will perform multiple re-validation operations in turn. */ synchronized CompletableFuture<Void> silentRevalidateOnce() { return sequencer.sequential(() -> revalidate(value)).thenRun(() -> log.info("Successfully revalidat...
3.26
pulsar_WorkerServiceLoader_load_rdh
/** * Load the worker services for the given <tt>protocol</tt> list. * * @param wsNarPackage * worker service nar package * @param narExtractionDirectory * the directory to extract nar directory * @return the worker service */ static WorkerService load(String wsNarPackage, String narExtractionDirectory) ...
3.26
pulsar_WorkerServiceLoader_getWorkerServiceDefinition_rdh
/** * Retrieve the functions worker service definition from the provided worker service nar package. * * @param narPath * the path to the worker service NAR package * @return the worker service definition * @throws IOException * when fail to load the worker service or get the definition */ public static Wor...
3.26
pulsar_TimeWindow_current_rdh
/** * return current time window data. * * @param function * generate data. * @return */ public synchronized WindowWrap<T> current(Function<T, T> function) { long millis = System.currentTimeMillis(); if (millis < 0) { return null; } int ...
3.26
pulsar_OpenIDProviderMetadataCache_verifyIssuer_rdh
/** * Verify the issuer url, as required by the OpenID Connect spec: * * Per the OpenID Connect Discovery spec, the issuer value returned MUST be identical to the * Issuer URL that was directly used to retrieve the configuration information. This MUST also * be identical to the iss Claim value in ID Tokens issued ...
3.26
pulsar_OpenIDProviderMetadataCache_getOpenIDProviderMetadataForKubernetesApiServer_rdh
/** * Retrieve the OpenID Provider Metadata for the Kubernetes API server. This method is used instead of * {@link #getOpenIDProviderMetadataForIssuer(String)} because different validations are done. The Kubernetes * API server does not technically implement the complete OIDC spec for discovery, but it does implemen...
3.26
pulsar_LegacyHierarchicalLedgerRangeIterator_getLedgerRangeByLevel_rdh
/** * Get a single node level1/level2. * * @param level1 * 1st level node name * @param level2 * 2nd level node name * @throws IOException */ LedgerRange getLedgerRangeByLevel(final String level1, final String level2) throws IOException { StringBuilder nodeBuilder = threadLocalNodeBuilder.get(); no...
3.26
pulsar_LegacyHierarchicalLedgerRangeIterator_nextL1Node_rdh
/** * Iterate next level1 znode. * * @return false if have visited all level1 nodes * @throws InterruptedException/KeeperException * if error occurs reading zookeeper children */ private boolean nextL1Node() throws ExecutionException, InterruptedException, TimeoutException { ...
3.26
pulsar_LegacyHierarchicalLedgerRangeIterator_getEndLedgerIdByLevel_rdh
/** * Get the largest cache id in a specified node /level1/level2. * * @param level1 * 1st level node name * @param level2 * 2nd level node name * @return the largest ledger id */ private long getEndLedgerIdByLevel(String level1, String level2) throws IOException { return StringUtils.stringToHierarchicalLed...
3.26
pulsar_LedgerOffloader_scanLedgers_rdh
/** * Scans all the ManagedLedgers stored on this Offloader (usually a Bucket). * The callback should not modify/delete the ledgers. * * @param consumer * receives the * @param offloadDriverMetadata * additional metadata * @throws ManagedLedgerException */ default void scanLedgers(OffloadedLedgerMetadataCo...
3.26
pulsar_TxnLogBufferedWriter_m0_rdh
/** * If reach the thresholds {@link #batchedWriteMaxRecords} or {@link #batchedWriteMaxSize}, do flush. */ private void m0() { if (flushContext.asyncAddArgsList.size() >= batchedWriteMaxRecords) { metrics.triggerFlushByRecordsCount(flushContext.asyncAddArgsList.size(), bytesSize, System.currentTimeMillis() - f...
3.26
pulsar_TxnLogBufferedWriter_nextTimingTrigger_rdh
/** * * * Why not use {@link ScheduledExecutorService#scheduleAtFixedRate(Runnable, long, long, TimeUnit)} ? * Because: when the {@link #singleThreadExecutorForWrite} thread processes slowly, the scheduleAtFixedRate task * will continue to append tasks to the ledger thread, this burdens the ledger thread and leads ...
3.26
pulsar_TxnLogBufferedWriter_asyncAddData_rdh
/** * Append a new entry to the end of a managed ledger. All writes will be performed in the same thread. Callbacks are * executed in strict write order,but after {@link #close()}, callbacks that fail by state check will execute * earlier, and successful callbacks will not be affected. * * @param data * data en...
3.26
pulsar_TxnLogBufferedWriter_close_rdh
/** * Release resources and cancel pending tasks. */ public CompletableFuture<Void> close() { // If batch feature is disabled, there is nothing to close, so set the stat only. if (!batchEnabled) { STATE_UPDATER.compareAndSet(this, State.OPEN, State.CLOSED); return CompletableFuture.com...
3.26
pulsar_TxnLogBufferedWriter_newInstance_rdh
/** * This constructor is used only when batch is disabled. Different to * {@link AsyncAddArgs#newInstance(AddDataCallback, Object, long)} has {@param byteBuf}. The {@param byteBuf} * generated by {@link DataSerializer#serialize(Object)} will be released during callback when * {@link #recycle()} executed. */ priva...
3.26
pulsar_TxnLogBufferedWriter_internalAsyncAddData_rdh
/** * Append data to queue, if reach {@link #batchedWriteMaxRecords} or {@link #batchedWriteMaxSize}, do flush. And if * accept a request that {@param data} is too large (larger than {@link #batchedWriteMaxSize}), then two flushes * are executed: * 1. Write the data cached in the queue to BK. * 2. Direct wri...
3.26
pulsar_WebServer_addRestResource_rdh
/** * Add a REST resource to the servlet context. * * @param basePath * The base path for the resource. * @param attribute * An attribute associated with the resource. * @param attributeValue * The value of the attribute. * @param resourceClass * The class representing the resource. * @param requireA...
3.26
pulsar_LongHierarchicalLedgerRangeIterator_isLedgerParentNode_rdh
/** * whether the child of ledgersRootPath is a top level parent znode for * ledgers (in HierarchicalLedgerManager) or znode of a ledger (in * FlatLedgerManager). */ public boolean isLedgerParentNode(String path) { return path.matches(StringUtils.LONGHIERARCHICAL_LEDGER_PARENT_NODE_REGEX); }
3.26
pulsar_LongHierarchicalLedgerRangeIterator_getChildrenAt_rdh
/** * Returns all children with path as a parent. If path is non-existent, * returns an empty list anyway (after all, there are no children there). * Maps all exceptions (other than NoNode) to IOException in keeping with * LedgerRangeIterator. * * @param path * @return Iterator into set of all children with pat...
3.26
pulsar_LongHierarchicalLedgerRangeIterator_advance_rdh
/** * Resolves the difference between cases 1 and 2 after nextLevelIterator is exhausted. * Pre-condition: nextLevelIterator == null, thisLevelIterator != null * Post-condition: nextLevelIterator == null && !thisLevelIterator.hasNext() OR * nextLevelIterator.hasNext() == true and nextLevelIterator.n...
3.26
pulsar_Function_close_rdh
/** * Called once to properly close resources when function instance is stopped. * * @throws Exception * if an error occurs */ default void close() throws Exception { }
3.26
pulsar_Function_initialize_rdh
/** * Called once to initialize resources when function instance is started. * * @param context * The Function context * @throws Exception * if an error occurs */ default void initialize(Context context) throws Exception { }
3.26
pulsar_AbstractAwsConnector_defaultCredentialProvider_rdh
/** * It creates a default credential provider which takes accessKey and secretKey form configuration and creates. * {@link AWSCredentials} * * @param awsCredentialPluginParam * @return */ public AwsCredentialProviderPlugin defaultCredentialProvider(String awsCredentialPluginParam) { Map<String, String> crede...
3.26
pulsar_FixedColumnLengthTableMaker_addSpace_rdh
// Helper function to pad with white space. private void addSpace(final int amount, final StringBuilder builder) { for (int i = 0; i < amount; ++i) { builder.append(' '); } }
3.26
pulsar_FixedColumnLengthTableMaker_addHorizontalBorder_rdh
// Helper function to add top and bottom borders. private void addHorizontalBorder(final int length, final StringBuilder builder, final char borderChar) { for (int i = 0; i < length; ++i) { builder.append(borderChar); } }
3.26
pulsar_FixedColumnLengthTableMaker_make_rdh
/** * Make a table using the specified settings. * * @param rows * Rows to construct the table from. * @return A String version of the table. */ public String make(final Object[][] rows) { final StringBuilder builder = new StringBuilder(); int numColumns = 0; ...
3.26
pulsar_TopicMessageIdImpl_getTopicPartitionName_rdh
/** * Get the topic name which contains partition part for this message. * * @return the topic name which contains Partition part */ @Deprecated public String getTopicPartitionName() { return getOwnerTopic(); }
3.26
pulsar_ProducerConfiguration_m2_rdh
/** * * @return the configured compression type for this producer */ public CompressionType m2() { return conf.getCompressionType(); }
3.26
pulsar_ProducerConfiguration_setMaxPendingMessagesAcrossPartitions_rdh
/** * Set the number of max pending messages across all the partitions * <p> * This setting will be used to lower the max pending messages for each partition * ({@link #setMaxPendingMessages(int)}), if the total exceeds the configured value. * * @param maxPendingMessagesAcrossPartitions */ public void setMaxPe...
3.26
pulsar_ProducerConfiguration_getCryptoFailureAction_rdh
/** * * @return The ProducerCryptoFailureAction */ public ProducerCryptoFailureAction getCryptoFailureAction() { return conf.getCryptoFailureAction(); }
3.26
pulsar_ProducerConfiguration_setMaxPendingMessages_rdh
/** * Set the max size of the queue holding the messages pending to receive an acknowledgment from the broker. * <p> * When the queue is full, by default, all calls to {@link Producer#send} and {@link Producer#sendAsync} will fail * unless blockIfQueueFull is set to true. Use {@link #setBlockIfQueueFull} to change ...
3.26
pulsar_ProducerConfiguration_setProperty_rdh
/** * Set a name/value property with this producer. * * @param key * @param value * @return */ public ProducerConfiguration setProperty(String key, String value) { checkArgument(key != null); checkArgument(value != null); conf.getProperties().put(key, value); return this; }
3.26
pulsar_ProducerConfiguration_setBlockIfQueueFull_rdh
/** * Set whether the {@link Producer#send} and {@link Producer#sendAsync} operations should block when the outgoing * message queue is full. * <p> * Default is <code>false</code>. If set to <code>false</code>, send operations will immediately fail with * {@link PulsarClientException.ProducerQueueIsFullError} when...
3.26
pulsar_ProducerConfiguration_isEncryptionEnabled_rdh
/** * Returns true if encryption keys are added. */ public boolean isEncryptionEnabled() { return conf.isEncryptionEnabled();}
3.26
pulsar_ProducerConfiguration_setMessageRouter_rdh
/** * Set a custom message routing policy by passing an implementation of MessageRouter. * * @param messageRouter */ public ProducerConfiguration setMessageRouter(MessageRouter messageRouter) { Objects.requireNonNull(messageRouter); setMessageRoutingMode(MessageRoutingMode.CustomPartition); conf.setCust...
3.26
pulsar_ProducerConfiguration_getMaxPendingMessagesAcrossPartitions_rdh
/** * * @return the maximum number of pending messages allowed across all the partitions */ public int getMaxPendingMessagesAcrossPartitions() { return conf.getMaxPendingMessagesAcrossPartitions(); }
3.26
pulsar_ProducerConfiguration_getSendTimeoutMs_rdh
/** * * @return the message send timeout in ms */ public long getSendTimeoutMs() { return conf.getSendTimeoutMs(); }
3.26
pulsar_ProducerConfiguration_getMessageRoutingMode_rdh
/** * Get the message routing mode for the partitioned producer. * * @return message routing mode, default is round-robin routing. * @see MessageRoutingMode#RoundRobinPartition */ public MessageRoutingMode getMessageRoutingMode() { return MessageRoutingMode.valueOf(conf.getMessageRoutingMode().toString()); }
3.26
pulsar_ProducerConfiguration_setProperties_rdh
/** * Add all the properties in the provided map. * * @param properties * @return */ public ProducerConfiguration setProperties(Map<String, String> properties) { conf.getProperties().putAll(properties);return this; }
3.26
pulsar_ProducerConfiguration_setMessageRoutingMode_rdh
/** * Set the message routing mode for the partitioned producer. * * @param messageRouteMode * message routing mode. * @return producer configuration * @see MessageRoutingMode */ public ProducerConfiguration setMessageRoutingMode(MessageRoutingMode messageRouteMode) { Objects.requireNonNull(messageRouteMo...
3.26
pulsar_ProducerConfiguration_setSendTimeout_rdh
/** * Set the send timeout <i>(default: 30 seconds)</i> * <p> * If a message is not acknowledged by the server before the sendTimeout expires, an error will be reported. * * @param sendTimeout * the send timeout * @param unit * the time unit of the {@code sendTimeout} */ public ProducerConfiguration setSen...
3.26
pulsar_ProducerConfiguration_setProducerName_rdh
/** * Specify a name for the producer * <p> * If not assigned, the system will generate a globally unique name which can be access with * {@link Producer#getProducerName()}. * <p> * When specifying a name, it is app to the user to ensure that, for a given topic, the producer name is un...
3.26
pulsar_ProducerConfiguration_setInitialSequenceId_rdh
/** * Set the baseline for the sequence ids for messages published by the producer. * <p> * First message will be using (initialSequenceId + 1) as its sequence id and subsequent messages will be assigned * incremental sequence ids, if not otherwise specified. * * @param initialSequenceId * @return */ public Pro...
3.26
pulsar_ProducerConfiguration_addEncryptionKey_rdh
/** * Add public encryption key, used by producer to encrypt the data key. * * At the time of producer creation, Pulsar client checks if there are keys added to encryptionKeys. If keys are * found, a callback getKey(String keyName) is invoked against each key to load the values of the key. Application * should imp...
3.26
pulsar_ProducerConfiguration_getProducerName_rdh
/** * * @return the configured custom producer name or null if no custom name was specified * @since 1.20.0 */ public String getProducerName() { return conf.getProducerName(); }
3.26
pulsar_ProducerConfiguration_getMaxPendingMessages_rdh
/** * * @return the maximum number of messages allowed in the outstanding messages queue for the producer */ public int getMaxPendingMessages() { return conf.getMaxPendingMessages(); }
3.26
pulsar_ProducerConfiguration_getCryptoKeyReader_rdh
/** * * @return the CryptoKeyReader */ public CryptoKeyReader getCryptoKeyReader() { return conf.getCryptoKeyReader(); }
3.26
pulsar_ProducerConfiguration_getMessageRouter_rdh
/** * Get the message router set by {@link #setMessageRouter(MessageRouter)}. * * @return message router set by {@link #setMessageRouter(MessageRouter)}. */ public MessageRouter getMessageRouter() { return conf.getCustomMessageRouter(); }
3.26
pulsar_ProducerConfiguration_getEncryptionKeys_rdh
/** * * @return encryptionKeys */ public Set<String> getEncryptionKeys() { return conf.getEncryptionKeys(); }
3.26
pulsar_ProducerConfiguration_setCryptoKeyReader_rdh
/** * Sets a {@link CryptoKeyReader}. * * @param cryptoKeyReader * CryptoKeyReader object */ public ProducerConfiguration setCryptoKeyReader(CryptoKeyReader cryptoKeyReader) { Objects.requireNonNull(cryptoKeyReader); conf.setCryptoKeyReader(cryptoKeyReader); return this; }
3.26
pulsar_ComponentImpl_isSuperUser_rdh
/** * * @deprecated use {@link #isSuperUser(AuthenticationParameters)} */ @Deprecated public boolean isSuperUser(String clientRole, AuthenticationDataSource authenticationData) { AuthenticationParameters authParams = AuthenticationParameters.builder().clientRole(clientRole).clientAuthenticationDataSource(authenticat...
3.26
pulsar_ComponentImpl_isAuthorizedRole_rdh
/** * * @deprecated use {@link #isAuthorizedRole(String, String, AuthenticationParameters)} instead. */ @Deprecated public boolean isAuthorizedRole(String tenant, String namespace, String clientRole, AuthenticationDataSource authenticationData) throws PulsarAdminException { AuthenticationParameters authParams = Auth...
3.26
pulsar_ComponentImpl_allowFunctionOps_rdh
/** * * @deprecated use {@link #isSuperUser(AuthenticationParameters)} */ @Deprecated public boolean allowFunctionOps(NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) { AuthenticationParameters authParams = AuthenticationParameters.builder().clientRole(role).clientAuthentication...
3.26
pulsar_AbstractHierarchicalLedgerManager_asyncProcessLevelNodes_rdh
/** * Process hash nodes in a given path. */ void asyncProcessLevelNodes(final String path, final BookkeeperInternalCallbacks.Processor<String> processor, final AsyncCallback.VoidCallback finalCb, final Object context, final int successRc, final int failureRc) { store.getChildren(path).thenAccept(levelNodes -> ...
3.26
pulsar_AbstractHierarchicalLedgerManager_isLedgerParentNode_rdh
/** * whether the child of ledgersRootPath is a top level parent znode for * ledgers (in HierarchicalLedgerManager) or znode of a ledger (in * FlatLedgerManager). */ public boolean isLedgerParentNode(String path) { return path.matches(getLedgerParentNodeRegex());}
3.26
pulsar_AbstractHierarchicalLedgerManager_getLedgerId_rdh
// get ledger from all level nodes long getLedgerId(String... levelNodes) throws IOException { return StringUtils.stringToHierarchicalLedgerId(levelNodes);}
3.26
pulsar_AbstractHierarchicalLedgerManager_asyncProcessLedgersInSingleNode_rdh
/** * Process ledgers in a single zk node. * * <p> * for each ledger found in this zk node, processor#process(ledgerId) will be triggerred * to process a specific ledger. after all ledgers has been processed, the finalCb will * be called with provided context object. The RC passed to finalCb is decided by : * <u...
3.26
pulsar_AbstractHierarchicalLedgerManager_process_rdh
/** * Process list of items. * * @param data * List of data to process * @param processor * Callback to process element of list when success * @param finalCb * Final callback to be called after all elements in the list are processed * @param context * Context of final callback * @param successRc * ...
3.26
pulsar_SubscriptionStatsImpl_add_rdh
// if the stats are added for the 1st time, we will need to make a copy of these stats and add it to the current // stats public SubscriptionStatsImpl add(SubscriptionStatsImpl stats) { Objects.requireNonNull(stats); this.msgRateOut += stats.msgRateOut; this.msgThroughputOut += stats.msgThroughputOut...
3.26
pulsar_AuthorizationService_allowTopicOperation_rdh
/** * * @deprecated - will be removed after 2.12. Use async variant. */ @Deprecated public Boolean allowTopicOperation(TopicName topicName, TopicOperation operation, String originalRole, String role, AuthenticationDataSource authData) throws Exception { try { return allowTopicOperationAsync(topicName, operatio...
3.26
pulsar_AuthorizationService_allowTopicPolicyOperationAsync_rdh
/** * Grant authorization-action permission on a topic to the given client. * * @param topicName * @param policy * @param operation * @param role * @param authData * additional authdata in json for targeted authorization provider * @throws IllegalStateException * when failed to grant permission */ public...
3.26
pulsar_AuthorizationService_revokePermissionAsync_rdh
/** * Revoke authorization-action permission on a topic to the given client. * * @param topicName * @param role */ public CompletableFuture<Void> revokePermissionAsync(TopicName topicName, String role) { return provider.revokePermissionAsync(topicName, role); }
3.26
pulsar_AuthorizationService_m1_rdh
/** * Grant authorization-action permission on a namespace to the given client. * * @param namespaceName * @param operation * @param role * @param authData * additional authdata in json for targeted authorization provider * @return IllegalArgumentException when namespace not found * @throws IllegalStateExcep...
3.26
pulsar_AuthorizationService_isSuperUserOrAdmin_rdh
/** * Functions, sources, and sinks each have their own method in this class. This method first checks for * tenant admin access, then for namespace level permission. */ private CompletableFuture<Boolean> isSuperUserOrAdmin(NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) { retu...
3.26
pulsar_AuthorizationService_allowTenantOperation_rdh
/** * * @deprecated - will be removed after 2.12. Use async variant. */ @Deprecated public boolean allowTenantOperation(String tenantName, TenantOperation operation, String originalRole, String role, AuthenticationDataSource authData) throws Exception { try { return allowTenantOperationAsync(tenantName, operati...
3.26
pulsar_AuthorizationService_canLookupAsync_rdh
/** * Check whether the specified role can perform a lookup for the specified topic. * * For that the caller needs to have producer or consumer permission. * * @param topicName * @param role * @return * @throws Exception */ public CompletableFuture<Boolean> canLookupAsync(TopicName topicName, String role, Auth...
3.26
pulsar_AuthorizationService_allowTopicOperationAsync_rdh
/** * Grant authorization-action permission on a topic to the given client. * * @param topicName * @param operation * @param role * @param authData * additional authdata in json for targeted authorization provider * @return IllegalArgumentException when namespace not found * @throws IllegalStateException * ...
3.26
pulsar_AuthorizationService_allowTenantOperationAsync_rdh
/** * Grant authorization-action permission on a tenant to the given client. * * @param tenantName * tenant name * @param operation * tenant operation * @param role * role name * @param authData * additional authdata in json for targeted authorization provider * @return IllegalArgumentException when ...
3.26
pulsar_AuthorizationService_canProduceAsync_rdh
/** * Check if the specified role has permission to send messages to the specified fully qualified topic name. * * @param topicName * the fully qualified topic name associated with the topic. * @param role * the app id used to send messages to the topic. */ public CompletableFuture<Boolean> canProduceAsync(T...
3.26
pulsar_AuthorizationService_allowNamespacePolicyOperationAsync_rdh
/** * Grant authorization-action permission on a namespace to the given client. * * @param namespaceName * @param operation * @param role * @param authData * additional authdata in json for targeted authorization provider * @return IllegalArgumentException when namespace not found * @throws IllegalStateExcep...
3.26
pulsar_AuthorizationService_allowNamespacePolicyOperation_rdh
/** * * @deprecated - will be removed after 2.12. Use async variant. */ @Deprecated public boolean allowNamespacePolicyOperation(NamespaceName namespaceName, PolicyName policy, PolicyOperation operation, String originalRole, String role, AuthenticationDataSource authData) throws Exception { try { return ...
3.26
pulsar_AuthorizationService_allowTopicPolicyOperation_rdh
/** * * @deprecated - will be removed after 2.12. Use async variant. */ @Deprecated public Boolean allowTopicPolicyOperation(TopicName topicName, PolicyName policy, PolicyOperation operation, String originalRole, String role, AuthenticationDataSource authData) throws Exception { try { return allowTopicP...
3.26
pulsar_AuthorizationService_isValidOriginalPrincipal_rdh
/** * Validates that the authenticatedPrincipal and the originalPrincipal are a valid combination. * Valid combinations fulfill one of the following two rules: * <p> * 1. The authenticatedPrincipal is in {@link ServiceConfiguration#getProxyRoles()}, if, and only if, * the originalPrincipal is set to a role that is...
3.26
pulsar_AuthorizationService_canLookup_rdh
/** * Check whether the specified role can perform a lookup for the specified topic. * * For that the caller needs to have producer or consumer permission. * * @param topicName * @param role * @return * @throws Exception */public boolean canLookup(TopicName topicName, String role, AuthenticationDataSource au...
3.26
pulsar_AuthorizationService_revokeSubscriptionPermissionAsync_rdh
/** * Revoke subscription admin-api access for a role. * * @param namespace * @param subscriptionName * @param role * @return */ public CompletableFuture<Void> revokeSubscriptionPermissionAsync(NamespaceName namespace, String subscriptionName, String role, String authDataJson) { return provider.revokeSubscr...
3.26
pulsar_AuthorizationService_grantPermissionAsync_rdh
/** * Grant authorization-action permission on a topic to the given client. * * NOTE: used to complete with {@link IllegalArgumentException} when namespace not found or with * {@link IllegalStateException} when failed to grant permission. * * @param topicName * @param role * @param authDataJson * additional ...
3.26
pulsar_AuthorizationService_grantSubscriptionPermissionAsync_rdh
/** * Grant permission to roles that can access subscription-admin api. * * @param namespace * @param subscriptionName * @param roles * @param authDataJson * additional authdata in json for targeted authorization provider * @return */ public CompletableFuture<Void> grantSubscriptionPermissionAsync(NamespaceN...
3.26
pulsar_JwksCache_getJwkAndMaybeReload_rdh
/** * Retrieve the JWK for the given key ID from the given JWKS URI. If the key ID is not found, and failOnMissingKeyId * is false, then the JWK will be reloaded from the JWKS URI and the key ID will be searched for again. */ private CompletableFuture<Jwk> getJwkAndMaybeReload(Optional<String> maybeJwksUri, String...
3.26
pulsar_JwksCache_convertToJwks_rdh
/** * The JWK Set is stored in the "keys" key see https://www.rfc-editor.org/rfc/rfc7517#section-5.1. * * @param jwksUri * - the URI used to retrieve the JWKS * @param jwks * - the JWKS to convert * @return a list of {@link Jwk} */ private List<Jwk> convertToJwks(String jwksUri, Map<String, Object> jwks) th...
3.26
pulsar_BookieServiceInfoSerde_extractBookiedIdFromPath_rdh
/** * Extract the BookieId * The path should look like /ledgers/available/bookieId * or /ledgers/available/readonly/bookieId. * But the prefix depends on the configuration. * * @param path * @return the bookieId */private static String extractBookiedIdFromPath(String path) throws IOException { // https://github...
3.26
pulsar_KubernetesRuntime_start_rdh
/** * The core logic that creates a service first followed by statefulset. */ @Override public void start() throws Exception { try { submitService();submitStatefulSet(); } catch (Exception e) { log.error("Failed start function {}/{}/{} in Kubernetes", f1.getFunctionDetails().getTenant(), f1.getFunctionDet...
3.26
pulsar_PulsarAuth_cleanSession_rdh
/** * When the session is closed, this method needs to be called to clear the session's auth verification status. */ public void cleanSession(ConnectorSession session) { authorizedQueryTopicsMap.remove(session.getQueryId()); }
3.26
pulsar_PulsarAuth_checkTopicAuth_rdh
/** * Check if the session has read access to the topic. * It will try to subscribe to that topic using the Pulsar Reader to check the consumption privilege. * The same topic will only be checked once during the same session. */ public void checkTopicAuth(ConnectorSession session, String topic) { Set<String> au...
3.26
pulsar_CliCommand_getOneArgument_rdh
/** * * @param params * List of positional arguments * @param pos * Positional arguments start with index as 1 * @param maxArguments * Validate against max arguments * @return */ static String getOneArgument(List<String> params, int pos, int maxArguments) { if (params.size() != maxArguments) { throw new ...
3.26
pulsar_ThreadLocalStateCleaner_cleanupThreadLocal_rdh
// use reflection to clear the state of the given thread local and thread public <T> void cleanupThreadLocal(ThreadLocal<?> threadLocal, Thread thread, BiConsumer<Thread, T> cleanedValueListener) { Objects.nonNull(threadLocal); Objects.nonNull(thread); ...
3.26