### Start ScalarDL Ledger and Dependencies Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Run the ScalarDL Ledger service along with its dependent components. This command starts the core ScalarDL functionality. ```bash docker compose -f dynamodb/docker-compose-ledger.yml up -d ``` -------------------------------- ### Start ScalarDL Ledger Service Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Start the ScalarDL Ledger and its dependencies using Docker Compose. ```bash docker compose -f cassandra/docker-compose-ledger.yml up -d ``` -------------------------------- ### Start HashiCorp Vault Server Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-cluster/encrypt-data-at-rest Starts the Vault server in development mode and sets the necessary environment variables for Vault address and token. ```bash docker compose up vault -d export VAULT_ADDR="http://127.0.0.1:8200" export VAULT_TOKEN=root ``` -------------------------------- ### Start ScalarDL Ledger and Dependencies Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Launch ScalarDL Ledger and its associated components using Docker Compose. This command starts all services defined in the docker-compose-ledger.yml file. ```bash docker compose -f postgres/docker-compose-ledger.yml up -d ``` -------------------------------- ### Start a Transaction Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Initiates a new transaction using the `start` method. This is an alternative to `begin` for starting transactional operations. ```java // Start a transaction. DistributedTransaction transaction = transactionManager.start(); ``` -------------------------------- ### Clone ScalarDL Samples Repository Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Clone the ScalarDL samples repository to get started with the ledger tutorial. This command is run in the terminal. ```bash git clone https://github.com/scalar-labs/scalardl-samples.git cd scalardl-samples ``` -------------------------------- ### Start Transaction (Coordinator) Source: https://scalardb.scalar-labs.com/docs/latest/two-phase-commit-transactions Start a new two-phase commit transaction as the Coordinator using the `start` method. This method can optionally accept a transaction ID. ```java // Start a transaction. TwoPhaseCommitTransaction tx = transactionManager.start(); ``` ```java // Start a transaction by specifying a transaction ID. TwoPhaseCommitTransaction tx = transactionManager.start(""); ``` -------------------------------- ### Start SQL Server Instance Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Initiate the SQL Server container using Docker Compose. This command starts the SQL Server service in detached mode. ```bash docker compose -f sqlserver/docker-compose-ledger.yml up -d sqlserver ``` -------------------------------- ### Start Oracle Database Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Initiate the Oracle Database container using docker compose. ```bash docker compose -f oracle/docker-compose-ledger.yml up -d oracle ``` -------------------------------- ### Start ScalarDL Ledger and Dependencies Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Launch ScalarDL Ledger and its associated components with Docker Compose. This command starts all necessary services in detached mode. ```bash docker compose -f sqlserver/docker-compose-ledger.yml up -d ``` -------------------------------- ### Start ScalarDL Ledger and Dependencies Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Launch ScalarDL Ledger and its required components using Docker Compose. ```bash docker compose -f mysql/docker-compose-ledger.yml up -d ``` -------------------------------- ### Start ScalarDL Ledger and Dependencies Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Run ScalarDL Ledger and its associated components using docker compose. ```bash docker compose -f oracle/docker-compose-ledger.yml up -d ``` -------------------------------- ### Run SQL Server locally Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Start a SQL Server instance locally using Docker Compose. ```bash docker compose up -d sqlserver ``` -------------------------------- ### Start ScalarDL Ledger Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Run this command to start the ScalarDL Ledger service using Docker Compose. This command assumes all previous configuration steps have been completed. ```bash docker compose -f cosmosdb/docker-compose-ledger.yml up -d ``` -------------------------------- ### Start MySQL Database Locally Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Initiate the MySQL database container using Docker Compose for ScalarDL Ledger. ```bash docker compose -f mysql/docker-compose-ledger.yml up -d mysql ``` -------------------------------- ### Run TiDB locally Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Start a TiDB instance locally using the TiUP playground. ```bash tiup playground v8.5 --without-monitor ``` -------------------------------- ### Start Cassandra for ScalarDL Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Run the Cassandra service locally using Docker Compose as a prerequisite for ScalarDL Ledger. ```bash docker compose -f cassandra/docker-compose-ledger.yml up -d cassandra ``` -------------------------------- ### Run PostgreSQL locally Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Start a PostgreSQL instance locally using Docker Compose. ```bash docker compose up -d postgres ``` -------------------------------- ### Run YugabyteDB locally Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Start a YugabyteDB instance locally using Docker Compose. ```bash docker compose up -d yugabyte ``` -------------------------------- ### Begin a Transaction Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Initiates a new transaction using the `begin` method. This is a standard way to start a transactional operation. ```java // Begin a transaction. DistributedTransaction transaction = transactionManager.begin(); ``` -------------------------------- ### Start DynamoDB Locally Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Initiate the DynamoDB service using Docker Compose. This command ensures DynamoDB is running before other ScalarDL components. ```bash docker compose -f dynamodb/docker-compose-ledger.yml up -d dynamodb ``` -------------------------------- ### Clone ScalarDL Samples Repository Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Clone the official ScalarDL samples repository to access configuration files and examples. ```bash git clone https://github.com/scalar-labs/scalardl-samples ``` -------------------------------- ### Run Cassandra Locally with Docker Compose Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Start Apache Cassandra in Docker Compose using the provided `docker-compose.yml` file. ```bash docker compose up -d cassandra ``` -------------------------------- ### Navigate to ScalarDB Sample Directory Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Change the directory to the ScalarDB sample application. ```bash cd scalardb-samples/scalardb-sample ``` -------------------------------- ### Load Initial Data for ScalarDB Sample Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Execute this command to load the initial dataset into the ScalarDB sample application tables. ```bash ./gradlew run --args="LoadInitialData" ``` -------------------------------- ### Transaction Mode Example Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-sql/sql-api-guide Demonstrates how to manage transactions using the ScalarDB SQL API. Includes starting a transaction, executing statements, committing, and handling specific exceptions like UnknownTransactionStatusException and SqlException for rollback and retry logic. ```Java try { // Begin a transaction sqlSession.begin(); // Execute statements (SELECT/INSERT/UPDATE/DELETE) in the transaction ... // Commit the transaction sqlSession.commit(); } catch (UnknownTransactionStatusException e) { // If you catch `UnknownTransactionStatusException`, it indicates that the status of the // transaction, whether it has succeeded or not, is unknown. In such a case, you need to check if // the transaction is committed successfully or not and retry it if it failed. How to identify a // transaction status is delegated to users } catch (SqlException e) { // For other exceptions, you can try retrying the transaction // Rollback the transaction sqlSession.rollback(); // For `TransactionRetryableException`, you can basically retry the transaction. However, for // the other exceptions, the transaction may still fail if the cause of the exception is // nontransient. For such a case, you need to limit the number of retries and give up retrying } ``` -------------------------------- ### Basic Prepared Statement Usage Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-sql/sql-api-guide Demonstrates the basic creation and execution of a prepared statement. Use this for queries executed multiple times to leverage caching. ```java PreparedStatement preparedStatement = sqlSession.prepareStatement(""); ResultSet result = sqlSession.execute(preparedStatement.bind()); ``` -------------------------------- ### Use Placeholders for Username and Password Source: https://scalardb.scalar-labs.com/docs/latest/configurations Example configuration demonstrating the use of environment variables for username and password, with a default value for username. ```properties scalar.db.username=${env:SCALAR_DB_USERNAME:-admin} scalar.db.password=${env:SCALAR_DB_PASSWORD} ``` -------------------------------- ### Start a Transaction with a Specific ID Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Starts a transaction and associates it with a provided transaction ID. This is an alternative to `begin` for linking external systems. ```java // Start a transaction by specifying a transaction ID. DistributedTransaction transaction = transactionManager.start(""); ``` -------------------------------- ### Create Namespaces and Tables using Properties File Source: https://scalardb.scalar-labs.com/docs/latest/schema-loader Use this command to create namespaces and tables by specifying a properties file for database configuration and a schema file. ```bash java -jar scalardb-schema-loader-.jar --config -f [--coordinator] ``` -------------------------------- ### Set Operation Attributes in Get Operation Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Demonstrates how to set operation-scoped attributes for a Get operation using `attribute()` and `attributes()` methods. ```java // Set operation attributes in the `Get` operation. Get get = Get.newBuilder() .namespace("ns") .table("tbl") .partitionKey(partitionKey) .clusteringKey(clusteringKey) .attribute("attribute1", "value1") .attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3")) .build(); ``` -------------------------------- ### Start PostgreSQL Container Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Initiate the PostgreSQL database service using Docker Compose. This command starts the PostgreSQL container in detached mode. ```bash docker compose -f postgres/docker-compose-ledger.yml up -d postgres ``` -------------------------------- ### Get Operation with Condition Sets Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Construct a Get operation with complex conditions using ConditionSetBuilder, supporting AND-wise or OR-wise junctions of conditions. ```java // Create a `Get` operation with condition sets. Get get = Get.newBuilder() .namespace("ns") .table("tbl") .partitionKey(partitionKey) .clusteringKey(clusteringKey) .where( ConditionSetBuilder.condition(ConditionBuilder.column("c1").isLessThanInt(10)) .or(ConditionBuilder.column("c1").isGreaterThanInt(20)) .build()) .and( ConditionSetBuilder.condition(ConditionBuilder.column("c2").isLikeText("a%")) .or(ConditionBuilder.column("c2").isLikeText("b%")) .build()) .build(); ``` -------------------------------- ### Navigate to ScalarDL Samples Directory Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Change the current directory to the cloned scalardl-samples repository. ```bash cd scalardl-samples ``` -------------------------------- ### Start a Read-Only Transaction with a Specific ID Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Starts a read-only transaction with a specified transaction ID, offering an alternative to `beginReadOnly` for external system integration. ```java // Start a transaction in read-only mode by specifying a transaction ID. DistributedTransaction transaction = transactionManager.startReadOnly(""); ``` -------------------------------- ### Thunderbolt Initialization and Configuration Source: https://www.scalar-labs.com/contact Initializes Thunderbolt with various configurations including caching, site features, session IDs, and rendering details. It also includes logic for bot detection and sampling. ```javascript "use strict"; (self.webpackJsonp__wix_thunderbolt_app=self.webpackJsonp__wix_thunderbolt_app||[]).push([["9114"]],{ 80974(e,i,n){ let r,t,s,a; n.d(i,{K:()=>u}); var o=n(94756); let c="unknown", d=e=>{ let i,n,r=(i=e.cache,n=e.varnish,`${i||c},${n||c}`); return{caching:r,isCached:r.includes("hit"),...e.microPop?{microPop:e.microPop}:{}} }, l={WixSite:1,UGC:2,Template:3}, u=(r=(()=>{ let{fedops:e,viewerModel:{siteFeaturesConfigs:i,requestUrl:n,site:r,fleetConfig:t,commonConfig:s,interactionSampleRatio:a},clientSideRender:o,santaRenderingError:u}=window, p=(({requestUrl:e,interactionSampleRatio:i})=>{ let n=new URL(e).searchParams; return n.has("sampleEvents")?"true"===n.get("sampleEvents"):Math.random()<(i?1-i:.9) })({requestUrl:n,interactionSampleRatio:a}), m=(e=>{ let{userAgent:i}=e.navigator; return/instagram.+google\/google/i.test(i)?"":/bot|google(?!play)|phantom|crawl|spider|headless|slurp|facebookexternal|Lighthouse|PTST|^mozilla\/4\.0$|^\s*$/i.test(i)?"ua":"" })(window)||(()=>{ try{ if(window.self===window.top)return"" }catch{} return"iframe" })()||(()=>{ if(!Function.prototype.bind)return"bind"; let{document:e,navigator:i}=window; if(!e||!i)return"document"; let{webdriver:n,userAgent:r,plugins:t,languages:s}=i; if(n)return"webdriver"; if(!t||Array.isArray(t))return"plugins"; if(Object.getOwnPropertyDescriptor(t,"0")?.writable)return"plugins-extra"; if(!r)return"userAgent"; if(r.indexOf("Snapchat")>0&&e.hidden)return"Snapchat"; if(!s||0===s.length||!Object.isFrozen(s))return"languages"; try{ throw Error() }catch(e){if(e instanceof Error){let{stack:i}=e;if(i&&/ (\(internal\/)|(\(?file:\/)/.test(i))return"stack"}} return"" })()||(({seo:e})=>e?.isInSEO?"seo":"")(i); return{ suppressbi:n.includes("suppressbi=true"), initialTimestamp:window.initialTimestamps.initialTimestamp, initialRequestTimestamp:window.initialTimestamps.initialRequestTimestamp, viewerSessionId:e.vsi, viewerName:r.appNameForBiEvents, siteRevision:String(r.siteRevision), msId:r.metaSiteId, is_rollout:0===t.code||1===t.code?t.code:null, is_platform_loaded:0, requestUrl:encodeURIComponent(n), sessionId:String(r.sessionId), btype:m, isjp:!!m, dc:r.dc, siteCacheRevision:"__siteCacheRevision__", checkVisibility:(()=>{ let e=!0; function i(){ e=e&&!0!==document.hidden } return document.addEventListener("visibilitychange",i,{passive:!0}),i(),()=>(i(),e)})(); ,...((e,i)=>{let n,r=(e=>{let i;try{i=e()}catch{i=[]}let n=i.reduce((e,i)=>(e[i.name]=i.description,e),{});return{cache:n.cache,varnish:n.varnish,microPop:n.dc}})(i);if(r.cache||r.varnish)return d({cache:r.cache||c,varnish:r.varnish||c,microPop:r.microPop});let t=(n=e.match(/ssr-caching="?cache\[,#\]\s*desc=([\w-]+)(?:[\,#]\s*varnish=(\w+))?(?:[\,#]\s*dc[\,#]\s*desc=([\w-]+))?(?:"|;|$)/))&&n.length?{cache:n[1],varnish:n[2]||c,microPop:n[3]}:null;return t?d(t):{caching:c,isCached:!1}})(document.cookie,()=>[...performance.getEntriesByType("navigation")[0].serverTiming||[]])), isMesh:1, st:l[r.siteType]||0, commonConfig:s, muteThunderboltEvents:p, isServerSide:+!o, isSuccessfulSSR:!o, fallbackReason:u?.errorInfo, mpaSessionId:e.mpaSessionId } })()), t={}, s=1, a=(e,i)=>{if(i&&performance.mark){let n=`${i} ` ``` -------------------------------- ### Execute Scan Operation with Boundaries and Projections Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Demonstrates creating a Scan operation with partition key, start and end clustering key boundaries, projections, orderings, a WHERE clause, and a limit. It shows how to execute the scan using both `transaction.scan()` and `transaction.getScanner()`. ```java Key partitionKey = Key.ofInt("c1", 10); Key startClusteringKey = Key.of("c2", "aaa", "c3", 100L); Key endClusteringKey = Key.of("c2", "aaa", "c3", 300L); Scan scan = Scan.newBuilder() .namespace("ns") .table("tbl") .partitionKey(partitionKey) .start(startClusteringKey, true) // Include startClusteringKey .end(endClusteringKey, false) // Exclude endClusteringKey .projections("c1", "c2", "c3", "c4") .orderings(Scan.Ordering.desc("c2"), Scan.Ordering.asc("c3")) .where(ConditionBuilder.column("c1").isNotEqualToInt(10)) .limit(10) .build(); // Execute the `Scan` operation by using the `transaction.scan()` method. List results = transaction.scan(scan); // Or, execute the `Scan` operation by using the `transaction.getScanner()` method. try (TransactionCrudOperable.Scanner scanner = transaction.getScanner(scan)) { // Fetch the next result from the scanner Optional result = scanner.one(); // Fetch all remaining results from the scanner List allResults = scanner.all(); } ``` -------------------------------- ### Execute Get Operation Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Executes a 'Get' operation to retrieve a single record. ScalarDB automatically begins and commits a transaction for this operation if one is not already active. ```java // Create a `Get` operation. Key partitionKey = Key.ofInt("c1", 10); Key clusteringKey = Key.of("c2", "aaa", "c3", 100L); Get get = Get.newBuilder() .namespace("ns") .table("tbl") .partitionKey(partitionKey) .clusteringKey(clusteringKey) .projections("c1", "c2", "c3", "c4") .build(); // Execute the `Get` operation. Optional result = transactionManager.get(get); ``` -------------------------------- ### BI Reporter Initialization Source: https://www.scalar-labs.com/contact Sets up a BI reporter with various reporting functions. It uses console logging as a default reporter if none is provided. ```javascript function i(e=n,t=n,r=()=>{},a=n,o=n){return{reportBI:e,sendBeat:t,setDynamicSessionData:r,reportPageNavigation:a,reportPageNavigationDone:o}} let n=(...e)=>console.log("\n\[TB\] ",...e) ``` -------------------------------- ### Place an Order in ScalarDB Sample Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Place an order for a customer, specifying item IDs and quantities. The format is :. ```bash ./gradlew run --args="PlaceOrder 1 1:3,2:2" ``` -------------------------------- ### Start PostgreSQL and ScalarDB Cluster Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-cluster/encrypt-data-at-rest Starts the PostgreSQL database and ScalarDB Cluster in standalone mode using Docker Compose. Allow a few minutes for ScalarDB Cluster to initialize. ```bash docker compose up postgresql scalardb-cluster-standalone -d ``` -------------------------------- ### Connect to PostgreSQL Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-cluster/encrypt-data-at-rest Use this command to establish a direct connection to the PostgreSQL instance for verification purposes. Note that this is not recommended for production environments. ```bash docker exec -it postgresql psql -U postgres ``` -------------------------------- ### Cookie Store API Wrapper (Get) Source: https://www.scalar-labs.com/contact Wraps the browser's CookieStore API 'get' method. Filters out cookies based on a provided set of names to exclude. ```javascript a({context:globalThis.CookieStore.prototype,property:"get",value:async function(t){return f(("string"==typeof t?t:t.name)||"",e)?null:r.call(this,t)},enumerable:!0}) ``` -------------------------------- ### Execute Get Operation Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Create a Get object specifying namespace, table, partition key, clustering key, projections, and optional conditions, then execute it using transaction.get(). ```java // Create a `Get` operation. Key partitionKey = Key.ofInt("c1", 10); Key clusteringKey = Key.of("c2", "aaa", "c3", 100L); Get get = Get.newBuilder() .namespace("ns") .table("tbl") .partitionKey(partitionKey) .clusteringKey(clusteringKey) .projections("c1", "c2", "c3", "c4") .where(ConditionBuilder.column("c1").isNotEqualToInt(10)) .build();// Execute the `Get` operation. Optional result = transaction.get(get); ``` -------------------------------- ### Configure ScalarDL Client Properties Source: https://scalardl.scalar-labs.com/docs/latest/getting-started Create a client.properties file with essential configurations for the client to connect to ScalarDL Ledger. ```bash cat << 'EOF' > client.properties # A host name for ScalarDL Ledger. scalar.dl.client.server.host=localhost # An ID for the certificate holder. This must be configured for each private key and must be unique in the system. scalar.dl.client.cert_holder_id=foo # A path to the certificate file. scalar.dl.client.cert_path=./fixture/client.pem # A path to the private key file. scalar.dl.client.private_key_path=./fixture/client-key.pem EOF ``` -------------------------------- ### Execute Get with Secondary Index Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Perform a Get operation using a secondary index instead of a partition key. This allows querying data based on indexed columns and applying additional conditions. ```java // Create a `Get` operation by using a secondary index. Key indexKey = Key.ofFloat("c4", 1.23F); Get get = Get.newBuilder() .namespace("ns") .table("tbl") .indexKey(indexKey) .projections("c1", "c2", "c3", "c4") .where(ConditionBuilder.column("c1").isNotEqualToInt(10)) .build(); // Execute the `Get` operation. Optional result = transaction.get(get); ``` -------------------------------- ### Get Column Values from Result Object Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Retrieve column values of various data types from a Result object using specific get methods. Ensure the correct type-casting method is used for each column. ```java // Get the BOOLEAN value of a column. boolean booleanValue = result.getBoolean(""); // Get the INT value of a column. int intValue = result.getInt(""); // Get the BIGINT value of a column. long bigIntValue = result.getBigInt(""); // Get the FLOAT value of a column. float floatValue = result.getFloat(""); // Get the DOUBLE value of a column. double doubleValue = result.getDouble(""); // Get the TEXT value of a column. String textValue = result.getText(""); // Get the BLOB value of a column as a `ByteBuffer`. ByteBuffer blobValue = result.getBlob(""); // Get the BLOB value of a column as a `byte` array. byte[] blobValueAsBytes = result.getBlobAsBytes(""); // Get the DATE value of a column as a `LocalDate`. LocalDate dateValue = result.getDate(""); // Get the TIME value of a column as a `LocalTime`. LocalTime timeValue = result.getTime(""); // Get the TIMESTAMP value of a column as a `LocalDateTime`. LocalDateTime timestampValue = result.getTimestamp(""); // Get the TIMESTAMPTZ value of a column as a `Instant`. Instant timestampTZValue = result.getTimestampTZ(""); ``` -------------------------------- ### CRUD Operations in Two-Phase Commit Transaction Source: https://scalardb.scalar-labs.com/docs/latest/two-phase-commit-transactions Perform Get and Put operations within a two-phase commit transaction. Ensure that the `Get` and `Put` objects are correctly constructed with namespace, table, partition key, and values. ```java TwoPhaseCommitTransaction tx = ...// Retrieve the current balances by ID. Get fromGet = Get.newBuilder() .namespace(NAMESPACE) .table(TABLE) .partitionKey(new Key(ID, fromId)) .build(); Get toGet = Get.newBuilder() .namespace(NAMESPACE) .table(TABLE) .partitionKey(new Key(ID, toId)) .build(); Optional fromResult = tx.get(fromGet); Optional toResult = tx.get(toGet); // Calculate the balances (assuming that both accounts exist). int newFromBalance = fromResult.get().getInt(BALANCE) - amount; int newToBalance = toResult.get().getInt(BALANCE) + amount; // Update the balances. Put fromPut = Put.newBuilder() .namespace(NAMESPACE) .table(TABLE) .partitionKey(new Key(ID, fromId)) .intValue(BALANCE, newFromBalance) .build(); Put toPut = Put.newBuilder() .namespace(NAMESPACE) .table(TABLE) .partitionKey(new Key(ID, toId)) .intValue(BALANCE, newToBalance) .build(); tx.put(fromPut); tx.put(toPut); ``` -------------------------------- ### Wix Thunderbolt BI LoggerFactory Setup Source: https://www.scalar-labs.com/contact This snippet sets up a BiLoggerFactory for Wix Thunderbolt, including configurations for Fedops, custom parameters, and experiment flags. It's used for performance monitoring and analytics. ```javascript "use strict";(self.webpackJsonp __wix_thunderbolt_app=self.webpackJsonp __wix_thunderbolt_app||[]).push([["6008"],{68703(e,t,r){r.d(t,{L:()=>i});var a=r(8716),o=r(26778),n=r(49254);let i=(0,a.Og)( [],()=>({definition:o.F,impl:n.J,config:{},platformConfig:{}}))},89973(e,t,r){r.d(t,{h:()=>i});var a=r(65672),o=r(48869);let n=({useBatch:e=!0,publishMethod:t=a.PublishMethods.Auto,endpoint:r,muteBi:o=!1,biStore:n,sessionManager:i,fetch:s,factory:d})=>d({useBatch:e,publishMethod:t,endpoint:r}).setMuted(o).withUoUContext({msid:n.msid}).withNonEssentialContext({visitorId:()=>i.getVisitorId(),siteMemberId:()=>i.getSiteMemberId()}).updateDefaults({vsi:n.viewerSessionId, _av: `thunderbolt-${n.viewerVersion} `,isb:n.is_headless,...n.is_headless&&{isbr:n.is_headless_reason}}),i={createBaseBiLoggerFactory:n,createBiLoggerFactoryForFedops:e=>{let{biStore:{session_id:t,initialTimestamp:r,initialRequestTimestamp:a,dc:i,microPop:s,is_headless:d,isCached:p,pageData:l,rolloutData:u,caching:c,checkVisibility:f=()=>"",viewerVersion:m,requestUrl:I,st:h,isSuccessfulSSR:A,mpaSessionId: _,siteOwnerId:E,uuid:S},muteBi:g=!1}=e;return n({...e,muteBi:g}).updateDefaults({ts:()=>Date.now()-r,tsn:()=>(function({initialRequestTimestamp:e,adjustForPrerender:t=!1}){if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByType)return;let e=(performance.getEntriesByType("navigation") [0])||{};return e?.activationStart??0})({initialRequestTimestamp:a,adjustForPrerender:!0}),dc:i,microPop:s,caching:c,session_id:t,st:h,url:I||l.pageUrl,ish:d,pn:l.pageNumber,isFirstNavigation:1===l.pageNumber,pv:f,pageId:l.pageId,isServerSide:!1,isSuccessfulSSR:A,is_lightbox:l.isLightbox,is_cached:p,is_sav_rollout:+!!u.siteAssetsVersionsRollout,is_dac_rollout:+!!u.isDACRollout,v:m,mpaSessionId: _,siteOwnerId:E,uuid:S,... "undefined"!=typeof document&&document.referrer&&{document_referrer:document.referrer},... "undefined"!=typeof navigator&&navigator.language&&{browserLanguage:navigator.language}})}})},48869(e,t,r){r.d(t,{b:()=>a});let a=()=>{let e=(()=>{if("undefined"==typeof performance||"function"!=typeof performance.getEntriesByType)return;let e=performance.getEntriesByType("navigation") [0])||{};return e?.activationStart??0})();return e?.activationStart??0}},35499(e,t,r){r.d(t,{W:()=>p});var a=r(41394),o=r(41789),n=r(683),i=r(4291),s=r(6355),d=r(76526);let p=({biLoggerFactory:e,customParams:t={},phasesConfig:r="SEND_ON_FINISH",appName:p="thunderbolt",presetType:l=a.u.BOLT,reportBlackbox:u=!1,paramsOverrides:c={},factory:f,muteThunderboltEvents:m=!1,experiments:I={},monitoringData:h})=>{let A, _,E,S,g,N,R,b,v=f(p,{presetType:l,phasesConfig:r,isPersistent:!0,isServerSide:!1,reportBlackbox:u,customParams:t,biLoggerFactory:e,paramsOverrides:c,enableSampleRateForAppNames:(0,d.isExperimentOpen)(I,"specs.thunderbolt.fedops_enableSampleRateForAppNames")??("undefined"!=typeof ``` -------------------------------- ### Get Metadata Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-sql/sql-api-guide Retrieves metadata information about the database schema using the SqlSession. ```Java Metadata metadata = sqlSession.getMetadata(); ``` -------------------------------- ### Begin Transaction (Coordinator) Source: https://scalardb.scalar-labs.com/docs/latest/two-phase-commit-transactions Initiate a new two-phase commit transaction as the Coordinator using the `begin` method. This method can optionally accept a transaction ID. ```java // Begin a transaction. TwoPhaseCommitTransaction tx = transactionManager.begin(); ``` ```java // Begin a transaction by specifying a transaction ID. TwoPhaseCommitTransaction tx = transactionManager.begin(""); ``` -------------------------------- ### Get Transaction ID Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-sql/sql-api-guide Retrieves the transaction ID assigned by the coordinator to participants. ```Java String transactionId = sqlSession.getTransactionId().orElseThrow(() -> new IllegalStateException("transaction ID is not available")); ``` -------------------------------- ### Get table metadata Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Retrieves the metadata for a specified table within a namespace. ```APIDOC ## Get table metadata ### Description Retrieves the metadata for a specified table within a namespace. ### Method `admin.getTableMetadata(namespace: String, table: String): TableMetadata` ### Parameters #### Path Parameters - **namespace** (String) - Required - The namespace of the table. - **table** (String) - Required - The name of the table. ### Returns - **TableMetadata** - An object containing the metadata for the specified table. ``` -------------------------------- ### Get tables of a namespace Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Retrieves the names of all tables within a specified namespace. ```APIDOC ## Get the tables of a namespace ### Description Retrieves the names of all tables within a specified namespace. ### Method `admin.getNamespaceTableNames(namespace: String): Set` ### Parameters #### Path Parameters - **namespace** (String) - Required - The name of the namespace. ### Returns - **Set** - A set containing the names of the tables in the specified namespace. ``` -------------------------------- ### Run MySQL Locally with Docker Compose Source: https://scalardb.scalar-labs.com/docs/latest/getting-started-with-scalardb Start a MySQL instance locally using Docker Compose. Ensure the `docker-compose.yml` file is present in the current directory. ```bash docker compose up -d mysql ``` -------------------------------- ### Get existing namespaces Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Retrieves the names of all existing namespaces that contain tables. ```APIDOC ## Get existing namespaces ### Description Retrieves the names of all existing namespaces that contain tables. ### Method `admin.getNamespaceNames(): Set` ### Returns - **Set** - A set containing the names of the namespaces. ``` -------------------------------- ### List Ledger Certificate Files Source: https://scalardl.scalar-labs.com/docs/latest/ca/caclient-getting-started Verify the creation of private key and certificate files for ScalarDL Ledger. This command lists all files in the current directory. ```bash ls -1 ``` -------------------------------- ### Get Table Metadata Source: https://scalardb.scalar-labs.com/docs/latest/api-guide Retrieves the metadata for a specified table within a namespace. ```Java // Get the table metadata for "ns.tbl". TableMetadata tableMetadata = admin.getTableMetadata("ns", "tbl"); ``` -------------------------------- ### Start ScalarDB Cluster SQL CLI Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-cluster/encrypt-data-at-rest Launches the ScalarDB SQL CLI with the specified configuration file. This tool is used for interacting with ScalarDB Cluster. ```bash java -jar scalardb-cluster-sql-cli-3.18.0-all.jar --config scalardb-cluster-sql-cli.properties ``` -------------------------------- ### Get ResultSet Column Definitions Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-sql/sql-api-guide Retrieve the column definitions metadata from a ResultSet. ```java ColumnDefinitions columnDefinitions = resultSet.getColumnDefinitions(); ``` -------------------------------- ### Get All Records from ResultSet Source: https://scalardb.scalar-labs.com/docs/latest/scalardb-sql/sql-api-guide Retrieve all records from a ResultSet as a List using the all() method. ```java List records = resultSet.all(); ``` -------------------------------- ### Initialize Business Intelligence Source: https://www.scalar-labs.com/contact Initializes the business intelligence module and sends an initial beat for tracking. Assumes a client-side rendering environment. ```javascript window.bi = p, window.bi.wixBiSession.isServerSide = +!window.clientSideRender, window.bi.wixBiSession.isSuccessfulSSR = !window.clientSideRender, window.clientSideRender && (window.bi.wixBiSession.fallbackReason = window.santaRenderingError?.errorInfo), p.sendBeat(1, "Init") ```