### Start Pravega Segment Store Service with Metrics Source: https://pravega.io/docs/latest/metrics This example demonstrates starting the Pravega Segment Store service, where the Metrics Service is initiated as a sub-service. It is sourced from `io.pravega.segmentstore.server.host.ServiceStarter`. ```java public static void main(String[] args) throws Exception { // ... other initializations ... SegmentStoreService.main(args); // ... other initializations ... } ``` -------------------------------- ### Example HelloWorldReader Output Source: https://pravega.io/docs/latest/getting-started This is an example of the output you might see when running the HelloWorldReader application. ```text ... Reading all the events from examples/helloStream ... Read event 'hello world' No more events from examples/helloStream ... ``` -------------------------------- ### Append Setup - Reply Source: https://pravega.io/docs/latest/wire-protocol Server reply confirming the setup for an append operation. ```APIDOC ## Append Setup - Reply This message is sent by the server to confirm that the append operation has been set up successfully. ### Fields - **RequestId** (Long): The client-generated ID corresponding to the setup append request. - **Segment** (String): The name of the Stream Segment to which data will be appended. - **writerId** (UUID): The identifier of the requesting appender. This ID is used to route subsequent append blocks. - **lastEventNumber** (Long): The number of the last event currently in the Stream Segment. ``` -------------------------------- ### Example HelloWorldWriter Output Source: https://pravega.io/docs/latest/getting-started This is an example of the output you might see when running the HelloWorldWriter application. ```text ... Writing message: 'hello world' with routing-key: 'helloRoutingKey' to stream 'examples / helloStream' ... ``` -------------------------------- ### Prerequisite Check: Java Version Source: https://pravega.io/docs/latest/getting-started Ensure Java 11 is installed before proceeding with Pravega setup. ```bash Java 11 ``` -------------------------------- ### Install NFS Server Provisioner with Helm Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Installs the NFS server provisioner using the stable Helm chart. Ensure Helm is configured with the stable repository. ```bash helm repo add stable https://charts.helm.sh/stable helm install stable/nfs-server-provisioner --generate-name ``` -------------------------------- ### Get Scaling Events Request Path Source: https://pravega.io/docs/latest/rest/restapis Example path for retrieving scaling events within a specified time range. ```text /scopes/string/streams/string/scaling-events?from=0&to=0 ``` -------------------------------- ### Example Table Segment Attribute Index Info Source: https://pravega.io/docs/latest/recovery-procedures/table-segment-recovery Example output from the 'table-segment get' command, showing metadata for an attribute index. Fields like version, length, and chunk count need to be updated during recovery. ```text > table-segment get _system/containers/storage_metadata_3 _system/_tables/completedTransactionsBatch-0$attributes.index 127.0.1.1 For the given key: _system/_tables/completedTransactionsBatch-0$attributes.index SLTS metadata info: key = _system/_tables/completedTransactionsBatch-0$attributes.index; version = 1654241463251; metadataType = SegmentMetadata; name = _system/_tables/completedTransactionsBatch-0$attributes.index; length = 13488706; chunkCount = 3; startOffset = 13135328; status = 1; maxRollingLength = 128767; firstChunk = _system/_tables/completedTransactionsBatch-0$attributes.index.E-5-O-13131945.29bd2254-2e77-4338-a41a-f9c2af07b913; lastChunk = _system/_tables/completedTransactionsBatch-0$attributes.index.E-5-O-13389479.5779f8d5-89ad-4bc6-87fe-3f99480a7271; lastModified = 0; firstChunkStartOffset = 13131945; lastChunkStartOffset = 13389479; ownerEpoch = 5; One would edit the following fields to update the metadata to reflect the chunk properties we have in step 6b). - Increment the version. - Update the length to reflect the cumulative length of chunk(s). In our example since there is just one Attribute chunk as seen in listing of step 5 we would update it length which is 458 (bytes). - Update the chunk count. in the case above it is 1, since there is just one chunk generated by the command in step 4. - Update the startOffset to 0. - Update the firstChunk to the one generated in step 4, which is `completedTransactionsBatch-0$attributes.index.E-1-O-0.7a9a16d4-cab6-4e5d-9173-d441d9656149` - Update the lastChunk to the same as firstChunk there is only one chunk. - Update the firstChunkStartOffset to 0. Derived from "E-1-[O]-0" part in file name. - Update the lastChunkStartOffset to 0. (first and last chunks are same.) This is how the resulting put command would look like: ``` -------------------------------- ### Start Bookkeeper Service Source: https://pravega.io/docs/latest/deployment/manual-install Start the Bookkeeper service (bookie) after performing necessary formatting. ```bash bin/bookkeeper bookie ``` -------------------------------- ### Example HTTP Request Path for Fetching Stream Properties Source: https://pravega.io/docs/latest/rest/restapis This is an example of the request path to fetch the properties of a specific stream. Replace 'string' with your actual scope and stream names. ```http /scopes/string/streams/string ``` -------------------------------- ### Example Request Body for Creating a Stream Source: https://pravega.io/docs/latest/rest/restapis This is an example of a request body for creating a stream. It includes optional configurations for scaling, retention policy, and other stream properties. ```json { "streamName" : "string", "scalingPolicy" : { "type" : "string", "targetRate" : 0, "scaleFactor" : 0, "minSegments" : 0 }, "retentionPolicy" : { "type" : "string", "value" : 0, "timeBasedRetention" : { "days" : 0, "hours" : 0, "minutes" : 0 }, "maxValue" : 0, "maxTimeBasedRetention" : { "days" : 0, "hours" : 0, "minutes" : 0 } }, "streamTags" : { }, "timestampAggregationTimeout" : { }, "rolloverSizeBytes" : { } } ``` -------------------------------- ### Global Metric Naming Example Source: https://pravega.io/docs/latest/metrics Example of a global metric name using the _global suffix. ```text segmentstore.segment.read_bytes_global ``` -------------------------------- ### Build Pravega samples Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Commands to access the pod, install dependencies, and build the sample applications. ```bash kubectl exec -it test-pod -- /bin/bash apt-get update apt-get -y install git-core openjdk-8-jdk git clone -b r0.8 https://github.com/pravega/pravega-samples cd pravega-samples ./gradlew installDist ``` -------------------------------- ### Start Pravega Standalone from Package Source: https://pravega.io/docs/latest/beginner_dev_guide Commands to extract the release package and launch the standalone server. ```bash tar xfvz pravega-.tgz ``` ```bash pravega-/bin/pravega-standalone ``` -------------------------------- ### Launch Pravega from Installation Package Source: https://pravega.io/docs/latest/deployment/run-local Extract the release tarball and execute the standalone startup script. ```bash $ tar xfvz pravega-.tgz ``` ```bash $ pravega-/bin/pravega-standalone ``` -------------------------------- ### Initialize Metrics Provider Source: https://pravega.io/docs/latest/metrics Initialize the MetricsProvider with configuration before starting the stats provider. This should be done when starting a Segment Store or Controller service. ```java MetricsProvider.initialize(Config.METRICS_CONFIG); statsProvider.start(metricsConfig); statsProvider = MetricsProvider.getMetricsProvider(); statsProvider.start(); ``` -------------------------------- ### Start Pravega standalone cluster Source: https://pravega.io/docs/latest/getting-started/quick-start Launch the Pravega standalone server process. ```bash ./bin/pravega-standalone ``` -------------------------------- ### Install Pravega Cluster with Helm Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Installs the Pravega cluster using the default Helm chart. This command assumes the Pravega operator is already deployed. ```bash helm install pravega pravega/pravega ``` -------------------------------- ### Start from Specific StreamCuts Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/ReaderGroupConfig.ReaderGroupConfigBuilder.html Ensures that readers in the reader group begin processing from the provided map of StreamCuts. This allows for setting distinct starting points for multiple streams. ```java public ReaderGroupConfig.ReaderGroupConfigBuilder startFromStreamCuts(java.util.Map streamCuts) ``` -------------------------------- ### Object-based Metric Naming Example Source: https://pravega.io/docs/latest/metrics Example of an object-based metric name including specific tags for granularity. ```text segmentstore.segment.read_bytes, ["scope", "...", "stream", "...", "segment", "...", "epoch", "..."]) ``` -------------------------------- ### TransactionalEventStreamWriter.beginTxn() Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Starts a new transaction on the event stream writer. ```APIDOC ## beginTxn() ### Description Start a new transaction on this stream. ### Method Method in interface io.pravega.client.stream.TransactionalEventStreamWriter ``` -------------------------------- ### Run Pravega Controller (after config) Source: https://pravega.io/docs/latest/deployment/manual-install Start the Pravega Controller after configuring its Zookeeper connection in `conf/controller.conf`. ```bash bin/pravega-controller ``` -------------------------------- ### Stream Output Example Source: https://pravega.io/docs/latest/clients-and-streams Expected output from the tail reader loop. ```text 4 5 6 null ``` -------------------------------- ### Example HTTP Response for Listing Reader Groups Source: https://pravega.io/docs/latest/rest/restapis This is an example of a successful HTTP response when listing reader groups. It returns a JSON object containing a list of reader group names. ```json { "readerGroups" : [ "object" ] } ``` -------------------------------- ### Setup Append - Request Source: https://pravega.io/docs/latest/wire-protocol Client request to initiate an append operation to a stream segment. ```APIDOC ## Setup Append - Request This message is sent by a client to prepare for appending data to a stream segment. ### Fields - **RequestId** (Long): The client-generated ID for this request. - **writerId** (UUID): A unique identifier for the appender initiating the operation. - **Segment** (String): The name of the Stream Segment to which data will be appended. - **delegationToken** (String): An authentication token provided by the Controller, granting permission for this operation. ``` -------------------------------- ### Get Configuration Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/EventStreamWriter.html Retrieves the configuration that the event writer was created with. ```APIDOC ## GET /config ### Description Returns the configuration that this writer was create with. ### Method GET ### Endpoint /config ### Parameters None ### Request Example (No request body for GET request) ### Response #### Success Response (200) - **EventWriterConfig** (object) - Writer configuration #### Response Example { "retryAttempts": 3, "automaticallyNoteTime": false } ``` -------------------------------- ### Run HelloWorldReader Sample Application Source: https://pravega.io/docs/latest/getting-started Execute the HelloWorldReader application to read events from the 'examples/helloStream'. Ensure you are in the correct directory after running installDist. ```bash cd pravega-samples/pravega-client-examples/build/install/pravega-client-examples ./bin/helloWorldReader ``` -------------------------------- ### Run HelloWorldWriter Sample Application Source: https://pravega.io/docs/latest/getting-started Execute the HelloWorldWriter application to send a 'hello world' message to a Pravega stream. Ensure you are in the correct directory after running installDist. ```bash cd pravega-samples/pravega-client-examples/build/install/pravega-client-examples ./bin/helloWorldWriter ``` -------------------------------- ### Get Writer Configuration Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/IdempotentEventStreamWriter.html Retrieves the configuration used to initialize the writer. ```java EventWriterConfig getConfig() ``` -------------------------------- ### Get Initial Backoff Millis Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/tables/KeyValueTableClientConfiguration.html Retrieves the initial backoff duration in milliseconds used for retries. This setting influences the starting delay in a backoff strategy. ```java public int getInitialBackoffMillis() ``` -------------------------------- ### Add Stream with Default Start Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/ReaderGroupConfig.ReaderGroupConfigBuilder.html Configures a reader group to read from a specific stream using its current starting position. Use this when the default starting point of the stream is acceptable. ```java public ReaderGroupConfig.ReaderGroupConfigBuilder stream(Stream stream) ``` -------------------------------- ### Bootstrap Java Application Source: https://pravega.io/docs/latest/beginner_dev_guide Initialize a new Java application project using Gradle. ```bash gradle init --type java-application ``` -------------------------------- ### Clone and Build Pravega from Source Source: https://pravega.io/docs/latest/deployment/run-local Download the source code and build the standalone distribution. ```bash $ git clone https://github.com/pravega/pravega.git $ cd pravega ``` ```bash ./gradlew startStandalone ``` -------------------------------- ### Create the test pod Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Command to deploy the test pod using the provided manifest file. ```bash kubectl create -f test-pod.yaml ``` -------------------------------- ### Add Stream with Start StreamCut Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/ReaderGroupConfig.ReaderGroupConfigBuilder.html Configures a reader group to read from a specific stream, starting at a defined StreamCut. The end of the stream is implied. Use this when you need to specify a starting point but not an explicit end. ```java public ReaderGroupConfig.ReaderGroupConfigBuilder stream(Stream stream, StreamCut startStreamCut) ``` -------------------------------- ### Configure Client Security Source: https://pravega.io/docs/latest/security/securing-standalone-mode-cluster Example of building a ClientConfig with TLS and authentication credentials for a secure Pravega connection. ```java ClientConfig clientConfig = ClientConfig.builder() .controllerURI(URI.create("tls://localhost:9090")) // TLS-related client-side configuration .trustStore("/path/to/ca-cert.crt") .validateHostName(false) // Auth-related client-side configuration .credentials(new DefaultCredentials(this.password, this.username)) .build(); ``` -------------------------------- ### Create Scope and Stream via CLI Source: https://pravega.io/docs/latest/getting-started/quick-start Initialize a scope and a stream using the Pravega CLI tool. ```text ./bin/pravega-cli > scope create my-scope > stream create my-scope/my-stream ``` -------------------------------- ### Install Zookeeper Operator Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Install the Zookeeper Operator using the Pravega Helm chart. This is the first step to manage Zookeeper clusters in Kubernetes. ```bash helm install zookeeper-operator pravega/zookeeper-operator ``` -------------------------------- ### Navigate to Configuration Directory Source: https://pravega.io/docs/latest/security/securing-standalone-mode-cluster Commands to change directory to the Pravega configuration folder. ```bash $ cd /path/to/pravega/config ``` ```bash $ cd /path/to/pravega-/conf ``` -------------------------------- ### Initialize and Join a Reader Group Source: https://pravega.io/docs/latest/reader-group-design Create a client factory and instantiate a reader that joins a specific reader group by name. ```java ClientFactory clientFactory = ClientFactory.withScope(scope, controllerURI); EventStreamReader< T > reader = clientFactory.createReader(readerId, READER_GROUP_NAME, serializer, readerConfig); ``` -------------------------------- ### KeyValueTableClientConfiguration Builder Methods Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Methods for configuring a KeyValueTable client, including initial backoff. ```APIDOC ## KeyValueTableClientConfiguration Builder ### Methods #### `initialBackoffMillis(int)` Sets the initial backoff in milliseconds used in the retry logic. ### Class io.pravega.client.tables.KeyValueTableClientConfiguration.KeyValueTableClientConfigurationBuilder ``` -------------------------------- ### Initialize KeyValueTableInfo Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/admin/KeyValueTableInfo.html Constructor for creating a new KeyValueTableInfo instance with a specified scope and table name. ```java @ConstructorProperties({"scope","keyValueTableName"}) public KeyValueTableInfo​(java.lang.String scope, java.lang.String keyValueTableName) ``` -------------------------------- ### Clone Pravega Samples Repository Source: https://pravega.io/docs/latest/getting-started Download the Pravega Samples git repository to access example applications. ```bash $ git clone https://github.com/pravega/pravega-samples cd pravega-samples ``` -------------------------------- ### Add Stream with Start and End StreamCuts Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/ReaderGroupConfig.ReaderGroupConfigBuilder.html Configures a reader group to read from a specific stream, starting and ending at defined StreamCuts. Use this when precise control over the read range within a stream is required. ```java public ReaderGroupConfig.ReaderGroupConfigBuilder stream(Stream stream, StreamCut startStreamCut, StreamCut endStreamCut) ``` -------------------------------- ### Example HTTP Response for Reader Group Properties Source: https://pravega.io/docs/latest/rest/restapis This is an example of a successful HTTP response when fetching reader group properties. It includes the scope name, reader group name, and associated stream list. ```json { "scopeName" : "string", "readerGroupName" : "string", "streamList" : [ "string" ], "onlineReaderIds" : [ "string" ] } ``` -------------------------------- ### Generate Java Keystore with Keytool Source: https://pravega.io/docs/latest/security/generating-tls-artifacts Commands for creating a JKS keystore for server authentication. Passwords can be provided as command-line arguments or entered interactively. ```bash # Passwords are passed as command line arguments. $ keytool -keystore server01.keystore.jks -alias server01 -validity -genkey \ -storepass -keypass \ -dname -ext SAN=DNS:, ``` ```bash # Passwords (and some other arguments) are to be entered interactively on the prompt. $ keytool -keystore server01.keystore.jks -alias server01 -genkey ``` -------------------------------- ### GET /admin/listScopes Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Retrieves an iterator for all available scopes. ```APIDOC ## GET /admin/listScopes ### Description Gets an iterator for all scopes defined in the system. ### Method GET ``` -------------------------------- ### Create KeyValueTable Client Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/KeyValueTableFactory.html Method to create a client for a specific Key-Value Table using the provided configuration. ```java KeyValueTable forKeyValueTable​(@NonNull @NonNull java.lang.String keyValueTableName, @NonNull @NonNull KeyValueTableClientConfiguration clientConfiguration) ``` -------------------------------- ### GET /scopes Source: https://pravega.io/docs/latest/rest/restapis List all available scopes in Pravega. ```APIDOC ## GET /scopes ### Description List all available scopes in Pravega. ### Method GET ### Endpoint /scopes ### Response #### Success Response (200) - **ScopesList** (object) - List of currently available scopes. #### Response Example { "scopes": [ { "scopeName": "string" } ] } ``` -------------------------------- ### Run Pravega Controller Source: https://pravega.io/docs/latest/deployment/manual-install Start the Pravega Controller service. Replace `` with the IP address of your Zookeeper nodes. ```bash ZK_URL=:2181 bin/pravega-controller ``` -------------------------------- ### Configure Authentication Parameters Source: https://pravega.io/docs/latest/security/securing-standalone-mode-cluster Set these properties in standalone-config.properties to enable authentication. ```properties singlenode.security.auth.enable=true singlenode.security.auth.credentials.username=admin singlenode.security.auth.credentials.pwd=1111_aaaa singlenode.security.auth.pwdAuthHandler.accountsDb.location=../config/passwd ``` -------------------------------- ### GET /health/status Source: https://pravega.io/docs/latest/rest/restapis Fetch the status of the Controller service. ```APIDOC ## GET /health/status ### Description Fetch the status of the Controller service. ### Method GET ### Endpoint /health/status ### Response #### Success Response (200) - **HealthStatus** (object) - The health status of the Controller. #### Response Example {} ``` -------------------------------- ### Configure SSL/TLS Parameters Source: https://pravega.io/docs/latest/security/securing-standalone-mode-cluster Set these properties in standalone-config.properties to enable and configure SSL/TLS. ```properties singlenode.security.tls.enable=true singlenode.security.tls.protocolVersion=TLSv1.2,TLSv1.3 singlenode.security.tls.privateKey.location=../config/server-key.key singlenode.security.tls.certificate.location=../config/server-cert.crt singlenode.security.tls.keyStore.location=../config/server.keystore.jks singlenode.security.tls.keyStore.pwd.location=../config/server.keystore.jks.passwd singlenode.security.tls.trustStore.location=../config/client.truststore.jks ``` -------------------------------- ### Get Notification Type Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/notifications/Observable.html Retrieves the type of the notification. ```APIDOC ## GET /getType ### Description Get the notification type. ### Method GET ### Endpoint /getType ### Response #### Success Response (200) * **notificationType** (String) - The type of the notification. ``` -------------------------------- ### GET /stream/configuration/tags Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/StreamConfiguration.html Retrieves the tags configured for the Stream. ```APIDOC ## GET /stream/configuration/tags ### Description Returns the set of tags configured for the Stream. ### Method GET ### Response #### Success Response (200) - **tags** (Set) - A list of tags associated with the Stream. ``` -------------------------------- ### Import Certificate to Truststore Source: https://pravega.io/docs/latest/security/securing-standalone-mode-cluster Import the certificate into the JVM truststore using keytool. ```bash $ sudo keytool -importcert -alias local-CA \ -keystore /path/to/jre/lib/security/cacerts -file ca-cert.der ``` -------------------------------- ### Start Pravega Admin CLI Source: https://pravega.io/docs/latest/recovery-procedures/lts-recovery-steps Launch the Pravega admin CLI tool. This tool is used to perform various administrative tasks, including data recovery. ```bash ./bin/pravega-admin ``` -------------------------------- ### GET /transaction/status Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Retrieves the current status of a specific transaction. ```APIDOC ## GET /transaction/status ### Description Get the status of a transaction. ### Method GET ### Endpoint io.pravega.client.stream.TransactionInfo.getTransactionStatus() ``` -------------------------------- ### GET /admin/stream-tags Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Retrieves the tags associated with a specific stream. ```APIDOC ## GET /admin/stream-tags ### Description Gets the Tags associated with a stream. ### Method GET ### Endpoint /admin/stream-tags ### Parameters #### Query Parameters - **scope** (String) - Required - The scope name of the stream. - **streamName** (String) - Required - The name of the stream. ``` -------------------------------- ### GET /scopes/{scopeName} Source: https://pravega.io/docs/latest/rest/restapis Retrieve details of an existing scope. ```APIDOC ## GET /scopes/{scopeName} ### Description Retrieve details of an existing scope. ### Method GET ### Endpoint /scopes/{scopeName} ### Parameters #### Path Parameters - **scopeName** (string) - Required - Scope name. ### Response #### Success Response (200) - **ScopeProperty** (object) - Successfully retrieved the scope details. #### Response Example { "scopeName": "string" } ``` -------------------------------- ### initialize Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/state/StateSynchronizer.html Initializes the state for a new stream. ```APIDOC ## initialize ### Description Provides an initial value for a new stream if it has not been previously initialized. ### Parameters - **initial** (InitialUpdate) - Required - The initializer for the state. ``` -------------------------------- ### Install Bookkeeper Cluster Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Deploy a Bookkeeper cluster using the publicly available Helm chart. This command quickly sets up a Bookkeeper cluster. ```bash helm install bookkeeper pravega/bookkeeper ``` -------------------------------- ### GET /health/readiness Source: https://pravega.io/docs/latest/rest/restapis Fetches the readiness state of the Controller service. ```APIDOC ## GET /health/readiness ### Description Fetch the ready state of the Controller service. ### Method GET ### Endpoint /health/readiness ### Response #### Success Response (200) - **status** (boolean) - The ready status. #### Response Example true ``` -------------------------------- ### GET /health/liveness Source: https://pravega.io/docs/latest/rest/restapis Fetches the liveness state of the Controller service. ```APIDOC ## GET /health/liveness ### Description Fetch the liveness state of the Controller service. ### Method GET ### Endpoint /health/liveness ### Response #### Success Response (200) - **status** (boolean) - The alive status. #### Response Example true ``` -------------------------------- ### GET /stream/configuration/rollover-size Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/StreamConfiguration.html Retrieves the segment rollover size for the Stream. ```APIDOC ## GET /stream/configuration/rollover-size ### Description Returns the segment rollover size in bytes. A value of 0 indicates the server default will be used. ### Method GET ### Response #### Success Response (200) - **rolloverSizeBytes** (long) - The rollover size for the segment. ``` -------------------------------- ### Inspect Keystore Contents Source: https://pravega.io/docs/latest/security/generating-tls-artifacts Use keytool to list and verify the contents of a JKS keystore file. ```bash $ keytool -list -v -storepass changeit -keystore server.keystore.jks ``` -------------------------------- ### GET /stream/configuration/retention-policy Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/StreamConfiguration.html Retrieves the retention policy configured for the Stream. ```APIDOC ## GET /stream/configuration/retention-policy ### Description Returns the retention policy associated with the Stream configuration. ### Method GET ### Response #### Success Response (200) - **RetentionPolicy** (object) - The retention policy object for the Stream. ``` -------------------------------- ### Run Pravega Segment Store Source: https://pravega.io/docs/latest/deployment/manual-install Start the Pravega Segment Store service after applying the necessary configuration changes. ```bash bin/pravega-segmentstore ``` -------------------------------- ### Execute the console writer Source: https://pravega.io/docs/latest/getting-started/pravega-on-kubernetes-101 Commands to navigate to the build directory and run the console writer against the Pravega controller. ```bash cd pravega-client-examples/build/install/pravega-client-examples/ bin/consoleWriter -u tcp://pravega-pravega-controller:9090 ``` -------------------------------- ### GET /stream/configuration/scaling-policy Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/StreamConfiguration.html Retrieves the scaling policy configured for the Stream. ```APIDOC ## GET /stream/configuration/scaling-policy ### Description Returns the scaling policy associated with the Stream configuration. ### Method GET ### Response #### Success Response (200) - **ScalingPolicy** (object) - The scaling policy object for the Stream. ``` -------------------------------- ### Create KeyValueTableFactory Instance Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/KeyValueTableFactory.html Static method to initialize a factory instance for a given scope and configuration. ```java static KeyValueTableFactory withScope​(java.lang.String scope, ClientConfig config) ``` -------------------------------- ### Deploy Pravega with Docker Compose Source: https://pravega.io/docs/latest/deployment/run-local Commands to download, configure, and start a distributed Pravega deployment using Docker Compose. ```bash $ wget https://raw.githubusercontent.com/pravega/pravega/master/docker/compose/docker-compose.yml ``` ```bash $ git clone https://github.com/pravega/pravega.git ``` ```bash $ cd /path/to/pravega/docker/compose ``` ```bash $ export HOST_IP= ``` ```bash $ docker-compose up -d ``` ```bash $ docker-compose up -d -f docker-compose-nfs.yml ``` ```bash $ docker-compose ps ``` -------------------------------- ### Implement HelloWorldReader run method Source: https://pravega.io/docs/latest/basic-reader-and-writer This method initializes the stream manager, configures the reader group, and continuously reads events from the specified stream until no more events are available. ```java public void run() { StreamManager streamManager = StreamManager.create(controllerURI); final boolean scopeIsNew = streamManager.createScope(scope); StreamConfiguration streamConfig = StreamConfiguration.builder() .scalingPolicy(ScalingPolicy.fixed(1)) .build(); final boolean streamIsNew = streamManager.createStream(scope, streamName, streamConfig); final String readerGroup = UUID.randomUUID().toString().replace("-", ""); final ReaderGroupConfig readerGroupConfig = ReaderGroupConfig.builder() .stream(Stream.of(scope, streamName)) .build(); try (ReaderGroupManager readerGroupManager = ReaderGroupManager.withScope(scope, controllerURI)) { readerGroupManager.createReaderGroup(readerGroup, readerGroupConfig); } try (ClientFactory clientFactory = ClientFactory.withScope(scope, controllerURI); EventStreamReader reader = clientFactory.createReader("reader", readerGroup, new JavaSerializer(), ReaderConfig.builder().build())) { System.out.format("Reading all the events from %s/%s%n", scope, streamName); EventRead event = null; do { try { event = reader.readNextEvent(READER_TIMEOUT_MS); if (event.getEvent() != null) { System.out.format("Read event '%s'%n", event.getEvent()); } } catch (ReinitializationRequiredException e) { //There are certain circumstances where the reader needs to be reinitialized e.printStackTrace(); } } while (event.getEvent() != null); System.out.format("No more events from %s/%s%n", scope, streamName); } } ``` -------------------------------- ### GET /admin/listCompletedTransactions Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Lists recently completed transactions for a specific stream. ```APIDOC ## GET /admin/listCompletedTransactions ### Description List most recent completed (COMMITTED/ABORTED) transactions for a given stream. ### Method GET ### Parameters #### Query Parameters - **stream** (Stream) - Required - The stream to query for completed transactions. ``` -------------------------------- ### GET /admin/listKeyValueTables Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Retrieves an iterator for all Key-Value Tables within a scope. ```APIDOC ## GET /admin/listKeyValueTables ### Description Gets an iterator for all Key-Value Tables in the given scope. ### Method GET ### Parameters #### Query Parameters - **scope** (String) - Required - The scope to list Key-Value Tables from. ``` -------------------------------- ### GET /notification/type Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Retrieves the notification type for various observable components. ```APIDOC ## GET /notification/type ### Description Get the notification type. ### Method GET ### Endpoint io.pravega.client.stream.notifications.Observable.getType() ``` -------------------------------- ### GET /health/status/{id} Source: https://pravega.io/docs/latest/rest/restapis Fetch the status of a specific health contributor. ```APIDOC ## GET /health/status/{id} ### Description Fetch the status of a specific health contributor. ### Method GET ### Endpoint /health/status/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The id of an existing health contributor. ### Response #### Success Response (200) - **HealthStatus** (object) - The health status of the Controller. #### Response Example {} ``` -------------------------------- ### Initialize Zookeeper Paths for Pravega Source: https://pravega.io/docs/latest/deployment/manual-install Create necessary paths in Zookeeper for Pravega and Bookkeeper. Replace `<$ZK_URL>` with the actual Zookeeper node IP address. ```bash bin/zkCli.sh -server $ZK_URL create /pravega bin/zkCli.sh -server $ZK_URL create /pravega/bookkeeper ``` -------------------------------- ### GET /health/details Source: https://pravega.io/docs/latest/rest/restapis Fetches the detailed health information of the Controller service. ```APIDOC ## GET /health/details ### Description Fetch the details of the Controller service. ### Method GET ### Endpoint /health/details ### Response #### Success Response (200) - **details** (object) - The list of details. #### Response Example { } ``` -------------------------------- ### Client Factory Initialization Source: https://pravega.io/docs/latest/javadoc/clients/index-all.html Methods to create instances of various Pravega client factories using a scope and configuration or URI. ```APIDOC ## Static Method: withScope ### Description Creates a new instance of a client factory or manager for a given scope. ### Parameters - **scope** (String) - Required - The scope name. - **config** (ClientConfig) - Required - The client configuration. - **uri** (URI) - Required - The controller URI. ### Supported Interfaces - ReaderGroupManager - BatchClientFactory - ByteStreamClientFactory - EventStreamClientFactory - KeyValueTableFactory - SynchronizerClientFactory ``` -------------------------------- ### Builder Pattern Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/tables/KeyValueTableConfiguration.html Demonstrates how to use the builder pattern to create a KeyValueTableConfiguration object. ```APIDOC ## POST /KeyValueTableConfiguration/builder ### Description Creates a builder for KeyValueTableConfiguration. ### Method POST ### Endpoint /KeyValueTableConfiguration/builder ### Request Body (No request body specified for builder creation) ### Response #### Success Response (200) - **builder** (KeyValueTableConfiguration.KeyValueTableConfigurationBuilder) - The builder instance. #### Response Example ```json { "builder": "KeyValueTableConfiguration.KeyValueTableConfigurationBuilder" } ``` ``` -------------------------------- ### GET /health Source: https://pravega.io/docs/latest/rest/restapis Returns the overall health status of the Controller service. ```APIDOC ## GET /health ### Description Return the Health of the Controller service. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **name** (string) - Service name - **status** (object) - Status object - **readiness** (boolean) - Readiness status - **liveness** (boolean) - Liveness status - **details** (object) - Health details - **children** (object) - Child health results #### Response Example { "name" : "string", "status" : { }, "readiness" : true, "liveness" : true, "details" : { }, "children" : { "string" : "[healthresult](#healthresult)" } } ``` -------------------------------- ### KeyValueTableClientConfiguration Builder Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/tables/KeyValueTableClientConfiguration.html Use the builder() method to obtain a builder instance for creating KeyValueTableClientConfiguration objects. This is the entry point for configuring client-side settings. ```java public static KeyValueTableClientConfiguration.KeyValueTableClientConfigurationBuilder builder() ``` -------------------------------- ### GET /readerGroup/segmentDistribution Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/ReaderGroup.html Returns the current distribution of segments assigned to each reader. ```APIDOC ## GET /readerGroup/segmentDistribution ### Description Returns current distribution of number of segments assigned to each reader in the reader group. ### Method GET ### Response #### Success Response (200) - **distribution** (ReaderSegmentDistribution) - Instance describing the distribution of segments. ``` -------------------------------- ### Initialize DynamicLogger Source: https://pravega.io/docs/latest/metrics Obtain a dynamic logger instance from the MetricsProvider to begin tracking dynamic metrics. ```java DynamicLogger dynamicLogger = MetricsProvider.getDynamicLogger(); ``` -------------------------------- ### Deploy Client Application in Swarm Source: https://pravega.io/docs/latest/deployment/docker-swarm Command to deploy a client application into the pravega_default network. ```bash docker service create --name=myapp --network=pravega_default mycompany/myapp ``` ```bash --network=pravega_default. ``` -------------------------------- ### GET /listKeyValueTables Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/admin/KeyValueTableManager.html Retrieves an iterator for all Key-Value Tables in a given scope. ```APIDOC ## GET /listKeyValueTables ### Description Gets an iterator for all Key-Value Tables in the given scope. ### Parameters #### Query Parameters - **scopeName** (String) - Required - The name of the scope for which to list Key-Value Tables. ### Response #### Success Response (200) - **result** (Iterator) - An Iterator of KeyValueTableInfo objects. ``` -------------------------------- ### POST /initialize Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/state/StateSynchronizer.html Initializes a new stream with a provided initial state if the stream has not been previously initialized. ```APIDOC ## POST /initialize ### Description This method can be used to provide an initial value for a new stream if the stream has not been previously initialized. ### Method POST ### Endpoint /initialize ### Parameters #### Request Body * **initial** (InitialUpdate) - The initial state update for the stream. ### Request Example ```json { "initial": "initial state update object" } ``` ### Response #### Success Response (200) * **void** - This method does not return a value upon successful completion. #### Response Example (No response body for void methods) ``` -------------------------------- ### Define a TimeWindow Source: https://pravega.io/docs/latest/watermarking Example of defining a time window using two watermarks. ```java TimeWindow T1 = {W1.lowerbound, W2.upperbound} ``` -------------------------------- ### GET /health/{id} Source: https://pravega.io/docs/latest/rest/restapis Return the Health of a health contributor with a given id. ```APIDOC ## GET /health/{id} ### Description Return the Health of a health contributor with a given id. ### Method GET ### Endpoint /health/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The id of an existing health contributor. ### Response #### Success Response (200) - **HealthResult** (object) - The Health result of the Controller. #### Response Example { "name": "string", "status": {}, "readiness": true, "liveness": true, "details": {}, "children": { "string": "[healthresult](#healthresult)" } } ``` -------------------------------- ### GET /health/readiness/{id} Source: https://pravega.io/docs/latest/rest/restapis Fetches the readiness state of a specific health contributor. ```APIDOC ## GET /health/readiness/{id} ### Description Fetch the ready state of the health contributor. ### Method GET ### Endpoint /health/readiness/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The id of an existing health contributor. ### Response #### Success Response (200) - **status** (boolean) - The readiness status for the health contributor. ``` -------------------------------- ### GET /health/liveness/{id} Source: https://pravega.io/docs/latest/rest/restapis Fetches the liveness state of a specific health contributor. ```APIDOC ## GET /health/liveness/{id} ### Description Fetch the liveness state of the specified health contributor. ### Method GET ### Endpoint /health/liveness/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The id of an existing health contributor. ### Response #### Success Response (200) - **status** (boolean) - The alive status for the specified health contributor. #### Response Example true ``` -------------------------------- ### GET /health/details/{id} Source: https://pravega.io/docs/latest/rest/restapis Fetches the health details for a specific health contributor. ```APIDOC ## GET /health/details/{id} ### Description Fetch the details of a specific health contributor. ### Method GET ### Endpoint /health/details/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The id of an existing health contributor. ### Response #### Success Response (200) - **details** (object) - The list of details for the health contributor. #### Response Example { } ``` -------------------------------- ### Begin Transaction Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/TransactionalEventStreamWriter.html Starts a new transaction. Events written within this transaction can be committed atomically. Transactions have a limited timeout. ```java Transaction beginTxn() ``` -------------------------------- ### GET /health/readiness Request and Response Source: https://pravega.io/docs/latest/rest/restapis Check the readiness state of the Controller service. ```text /health/readiness ``` ```json true ``` -------------------------------- ### Client Configuration Builders Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/ClientConfig.ClientConfigBuilder.html Methods for building and configuring ClientConfig instances. ```APIDOC ## ClientConfig.ClientConfigBuilder ### Description Provides methods to configure various aspects of the Pravega client. ### Methods #### validateHostName ##### Description If the flag `ClientConfig.isEnableTls()` is set, this flag decides whether to enable host name validation or not. ##### Parameters - **validateHostName** (boolean) - Required - Flag to decide whether to enable host name validation or not. ##### Returns - `this` (ClientConfig.ClientConfigBuilder) #### isDefaultMaxConnections ##### Description An internal property that determines if the client config. ##### Parameters - **isDefaultMaxConnections** (boolean) - Required - determines if the client config ##### Returns - `this` (ClientConfig.ClientConfigBuilder) #### metricListener ##### Description An optional listener which can be used to get performance metrics from the client. The user can implement this interface to obtain performance metrics of the client. ##### Parameters - **metricListener** (io.pravega.shared.metrics.MetricListener) - Optional - Listener to collect client performance metrics. ##### Returns - `this` (ClientConfig.ClientConfigBuilder) #### toString ##### Description Returns a string representation of the object. ##### Overrides - `toString` in class `java.lang.Object` ``` -------------------------------- ### Start from Checkpoint Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/stream/ReaderGroupConfig.ReaderGroupConfigBuilder.html Configures the reader group to resume reading from a previously saved Checkpoint. This is useful for fault tolerance and continuing processing from a known state. ```java public ReaderGroupConfig.ReaderGroupConfigBuilder startFromCheckpoint(Checkpoint checkpoint) ``` -------------------------------- ### GET /health/liveness Request and Response Source: https://pravega.io/docs/latest/rest/restapis Check the liveness state of the Controller service. ```text /health/liveness ``` ```json true ``` -------------------------------- ### Get All Table Entries Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/tables/KeyValueTable.html Retrieves the latest values for a collection of `TableKey`s from the KeyValueTable. ```APIDOC ## POST /api/keyvaluestable/getAll ### Description Retrieves the latest values for a set of `TableKey`s from the `KeyValueTable`. ### Method POST ### Endpoint /api/keyvaluestable/getAll ### Parameters #### Request Body - **keys** (Iterable) - Required - An `Iterable` of `TableKey`s to get values for. ### Request Example ```json { "keys": [ { "tableName": "myTable", "key": "key1" }, { "tableName": "myTable", "key": "key2" } ] } ``` ### Response #### Success Response (200) - **entries** (List) - A List of `TableEntry` instances for the requested keys. The size of the list matches `keys.size()`. Null entries correspond to keys that do not exist. #### Response Example ```json { "entries": [ { "key": { "tableName": "myTable", "key": "key1" }, "value": "value1", "version": "123e4567-e89b-12d3-a456-426614174000" }, null ] } ``` ``` -------------------------------- ### Create SynchronizerClientFactory Instance Source: https://pravega.io/docs/latest/javadoc/clients/io/pravega/client/SynchronizerClientFactory.html Static method to initialize a new factory instance with a specified scope and configuration. ```java static SynchronizerClientFactory withScope​(java.lang.String scope, ClientConfig config) ```