1/* 2 * generated.go 3 * 4 * This source file is part of the FoundationDB open source project 5 * 6 * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21// DO NOT EDIT THIS FILE BY HAND. This file was generated using 22// translate_fdb_options.go, part of the FoundationDB repository, and a copy of 23// the fdb.options file (installed as part of the FoundationDB client, typically 24// found as /usr/include/foundationdb/fdb.options). 25 26// To regenerate this file, from the top level of a FoundationDB repository 27// checkout, run: 28// $ go run bindings/go/src/_util/translate_fdb_options.go < fdbclient/vexillographer/fdb.options > bindings/go/src/fdb/generated.go 29 30package fdb 31 32import ( 33 "bytes" 34 "encoding/binary" 35) 36 37func int64ToBytes(i int64) ([]byte, error) { 38 buf := new(bytes.Buffer) 39 if e := binary.Write(buf, binary.LittleEndian, i); e != nil { 40 return nil, e 41 } 42 return buf.Bytes(), nil 43} 44 45// Deprecated 46// 47// Parameter: IP:PORT 48func (o NetworkOptions) SetLocalAddress(param string) error { 49 return o.setOpt(10, []byte(param)) 50} 51 52// Deprecated 53// 54// Parameter: path to cluster file 55func (o NetworkOptions) SetClusterFile(param string) error { 56 return o.setOpt(20, []byte(param)) 57} 58 59// Enables trace output to a file in a directory of the clients choosing 60// 61// Parameter: path to output directory (or NULL for current working directory) 62func (o NetworkOptions) SetTraceEnable(param string) error { 63 return o.setOpt(30, []byte(param)) 64} 65 66// Sets the maximum size in bytes of a single trace output file. This value should be in the range ``[0, INT64_MAX]``. If the value is set to 0, there is no limit on individual file size. The default is a maximum size of 10,485,760 bytes. 67// 68// Parameter: max size of a single trace output file 69func (o NetworkOptions) SetTraceRollSize(param int64) error { 70 b, e := int64ToBytes(param) 71 if e != nil { 72 return e 73 } 74 return o.setOpt(31, b) 75} 76 77// Sets the maximum size of all the trace output files put together. This value should be in the range ``[0, INT64_MAX]``. If the value is set to 0, there is no limit on the total size of the files. The default is a maximum size of 104,857,600 bytes. If the default roll size is used, this means that a maximum of 10 trace files will be written at a time. 78// 79// Parameter: max total size of trace files 80func (o NetworkOptions) SetTraceMaxLogsSize(param int64) error { 81 b, e := int64ToBytes(param) 82 if e != nil { 83 return e 84 } 85 return o.setOpt(32, b) 86} 87 88// Sets the 'LogGroup' attribute with the specified value for all events in the trace output files. The default log group is 'default'. 89// 90// Parameter: value of the LogGroup attribute 91func (o NetworkOptions) SetTraceLogGroup(param string) error { 92 return o.setOpt(33, []byte(param)) 93} 94 95// Select the format of the log files. xml (the default) and json are supported. 96// 97// Parameter: Format of trace files 98func (o NetworkOptions) SetTraceFormat(param string) error { 99 return o.setOpt(34, []byte(param)) 100} 101 102// Set internal tuning or debugging knobs 103// 104// Parameter: knob_name=knob_value 105func (o NetworkOptions) SetKnob(param string) error { 106 return o.setOpt(40, []byte(param)) 107} 108 109// Deprecated 110// 111// Parameter: file path or linker-resolved name 112func (o NetworkOptions) SetTLSPlugin(param string) error { 113 return o.setOpt(41, []byte(param)) 114} 115 116// Set the certificate chain 117// 118// Parameter: certificates 119func (o NetworkOptions) SetTLSCertBytes(param []byte) error { 120 return o.setOpt(42, param) 121} 122 123// Set the file from which to load the certificate chain 124// 125// Parameter: file path 126func (o NetworkOptions) SetTLSCertPath(param string) error { 127 return o.setOpt(43, []byte(param)) 128} 129 130// Set the private key corresponding to your own certificate 131// 132// Parameter: key 133func (o NetworkOptions) SetTLSKeyBytes(param []byte) error { 134 return o.setOpt(45, param) 135} 136 137// Set the file from which to load the private key corresponding to your own certificate 138// 139// Parameter: file path 140func (o NetworkOptions) SetTLSKeyPath(param string) error { 141 return o.setOpt(46, []byte(param)) 142} 143 144// Set the peer certificate field verification criteria 145// 146// Parameter: verification pattern 147func (o NetworkOptions) SetTLSVerifyPeers(param []byte) error { 148 return o.setOpt(47, param) 149} 150 151// Not yet implemented. 152func (o NetworkOptions) SetBuggifyEnable() error { 153 return o.setOpt(48, nil) 154} 155 156// Not yet implemented. 157func (o NetworkOptions) SetBuggifyDisable() error { 158 return o.setOpt(49, nil) 159} 160 161// Set the probability of a BUGGIFY section being active for the current execution. Only applies to code paths first traversed AFTER this option is changed. 162// 163// Parameter: probability expressed as a percentage between 0 and 100 164func (o NetworkOptions) SetBuggifySectionActivatedProbability(param int64) error { 165 b, e := int64ToBytes(param) 166 if e != nil { 167 return e 168 } 169 return o.setOpt(50, b) 170} 171 172// Set the probability of an active BUGGIFY section being fired 173// 174// Parameter: probability expressed as a percentage between 0 and 100 175func (o NetworkOptions) SetBuggifySectionFiredProbability(param int64) error { 176 b, e := int64ToBytes(param) 177 if e != nil { 178 return e 179 } 180 return o.setOpt(51, b) 181} 182 183// Set the ca bundle 184// 185// Parameter: ca bundle 186func (o NetworkOptions) SetTLSCaBytes(param []byte) error { 187 return o.setOpt(52, param) 188} 189 190// Set the file from which to load the certificate authority bundle 191// 192// Parameter: file path 193func (o NetworkOptions) SetTLSCaPath(param string) error { 194 return o.setOpt(53, []byte(param)) 195} 196 197// Set the passphrase for encrypted private key. Password should be set before setting the key for the password to be used. 198// 199// Parameter: key passphrase 200func (o NetworkOptions) SetTLSPassword(param string) error { 201 return o.setOpt(54, []byte(param)) 202} 203 204// Disables the multi-version client API and instead uses the local client directly. Must be set before setting up the network. 205func (o NetworkOptions) SetDisableMultiVersionClientApi() error { 206 return o.setOpt(60, nil) 207} 208 209// If set, callbacks from external client libraries can be called from threads created by the FoundationDB client library. Otherwise, callbacks will be called from either the thread used to add the callback or the network thread. Setting this option can improve performance when connected using an external client, but may not be safe to use in all environments. Must be set before setting up the network. WARNING: This feature is considered experimental at this time. 210func (o NetworkOptions) SetCallbacksOnExternalThreads() error { 211 return o.setOpt(61, nil) 212} 213 214// Adds an external client library for use by the multi-version client API. Must be set before setting up the network. 215// 216// Parameter: path to client library 217func (o NetworkOptions) SetExternalClientLibrary(param string) error { 218 return o.setOpt(62, []byte(param)) 219} 220 221// Searches the specified path for dynamic libraries and adds them to the list of client libraries for use by the multi-version client API. Must be set before setting up the network. 222// 223// Parameter: path to directory containing client libraries 224func (o NetworkOptions) SetExternalClientDirectory(param string) error { 225 return o.setOpt(63, []byte(param)) 226} 227 228// Prevents connections through the local client, allowing only connections through externally loaded client libraries. Intended primarily for testing. 229func (o NetworkOptions) SetDisableLocalClient() error { 230 return o.setOpt(64, nil) 231} 232 233// Disables logging of client statistics, such as sampled transaction activity. 234func (o NetworkOptions) SetDisableClientStatisticsLogging() error { 235 return o.setOpt(70, nil) 236} 237 238// Enables debugging feature to perform slow task profiling. Requires trace logging to be enabled. WARNING: this feature is not recommended for use in production. 239func (o NetworkOptions) SetEnableSlowTaskProfiling() error { 240 return o.setOpt(71, nil) 241} 242 243// Set the size of the client location cache. Raising this value can boost performance in very large databases where clients access data in a near-random pattern. Defaults to 100000. 244// 245// Parameter: Max location cache entries 246func (o DatabaseOptions) SetLocationCacheSize(param int64) error { 247 b, e := int64ToBytes(param) 248 if e != nil { 249 return e 250 } 251 return o.setOpt(10, b) 252} 253 254// Set the maximum number of watches allowed to be outstanding on a database connection. Increasing this number could result in increased resource usage. Reducing this number will not cancel any outstanding watches. Defaults to 10000 and cannot be larger than 1000000. 255// 256// Parameter: Max outstanding watches 257func (o DatabaseOptions) SetMaxWatches(param int64) error { 258 b, e := int64ToBytes(param) 259 if e != nil { 260 return e 261 } 262 return o.setOpt(20, b) 263} 264 265// Specify the machine ID that was passed to fdbserver processes running on the same machine as this client, for better location-aware load balancing. 266// 267// Parameter: Hexadecimal ID 268func (o DatabaseOptions) SetMachineId(param string) error { 269 return o.setOpt(21, []byte(param)) 270} 271 272// Specify the datacenter ID that was passed to fdbserver processes running in the same datacenter as this client, for better location-aware load balancing. 273// 274// Parameter: Hexadecimal ID 275func (o DatabaseOptions) SetDatacenterId(param string) error { 276 return o.setOpt(22, []byte(param)) 277} 278 279// Set a timeout in milliseconds which, when elapsed, will cause each transaction automatically to be cancelled. This sets the ``timeout`` option of each transaction created by this database. See the transaction option description for more information. Using this option requires that the API version is 610 or higher. 280// 281// Parameter: value in milliseconds of timeout 282func (o DatabaseOptions) SetTransactionTimeout(param int64) error { 283 b, e := int64ToBytes(param) 284 if e != nil { 285 return e 286 } 287 return o.setOpt(500, b) 288} 289 290// Set a timeout in milliseconds which, when elapsed, will cause a transaction automatically to be cancelled. This sets the ``retry_limit`` option of each transaction created by this database. See the transaction option description for more information. 291// 292// Parameter: number of times to retry 293func (o DatabaseOptions) SetTransactionRetryLimit(param int64) error { 294 b, e := int64ToBytes(param) 295 if e != nil { 296 return e 297 } 298 return o.setOpt(501, b) 299} 300 301// Set the maximum amount of backoff delay incurred in the call to ``onError`` if the error is retryable. This sets the ``max_retry_delay`` option of each transaction created by this database. See the transaction option description for more information. 302// 303// Parameter: value in milliseconds of maximum delay 304func (o DatabaseOptions) SetTransactionMaxRetryDelay(param int64) error { 305 b, e := int64ToBytes(param) 306 if e != nil { 307 return e 308 } 309 return o.setOpt(502, b) 310} 311 312// Snapshot read operations will see the results of writes done in the same transaction. This is the default behavior. 313func (o DatabaseOptions) SetSnapshotRywEnable() error { 314 return o.setOpt(26, nil) 315} 316 317// Snapshot read operations will not see the results of writes done in the same transaction. This was the default behavior prior to API version 300. 318func (o DatabaseOptions) SetSnapshotRywDisable() error { 319 return o.setOpt(27, nil) 320} 321 322// The transaction, if not self-conflicting, may be committed a second time after commit succeeds, in the event of a fault 323func (o TransactionOptions) SetCausalWriteRisky() error { 324 return o.setOpt(10, nil) 325} 326 327// The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a fault or partition 328func (o TransactionOptions) SetCausalReadRisky() error { 329 return o.setOpt(20, nil) 330} 331 332// Not yet implemented. 333func (o TransactionOptions) SetCausalReadDisable() error { 334 return o.setOpt(21, nil) 335} 336 337// The next write performed on this transaction will not generate a write conflict range. As a result, other transactions which read the key(s) being modified by the next write will not conflict with this transaction. Care needs to be taken when using this option on a transaction that is shared between multiple threads. When setting this option, write conflict ranges will be disabled on the next write operation, regardless of what thread it is on. 338func (o TransactionOptions) SetNextWriteNoWriteConflictRange() error { 339 return o.setOpt(30, nil) 340} 341 342// Reads performed by a transaction will not see any prior mutations that occured in that transaction, instead seeing the value which was in the database at the transaction's read version. This option may provide a small performance benefit for the client, but also disables a number of client-side optimizations which are beneficial for transactions which tend to read and write the same keys within a single transaction. 343func (o TransactionOptions) SetReadYourWritesDisable() error { 344 return o.setOpt(51, nil) 345} 346 347// Deprecated 348func (o TransactionOptions) SetReadAheadDisable() error { 349 return o.setOpt(52, nil) 350} 351 352// Not yet implemented. 353func (o TransactionOptions) SetDurabilityDatacenter() error { 354 return o.setOpt(110, nil) 355} 356 357// Not yet implemented. 358func (o TransactionOptions) SetDurabilityRisky() error { 359 return o.setOpt(120, nil) 360} 361 362// Deprecated 363func (o TransactionOptions) SetDurabilityDevNullIsWebScale() error { 364 return o.setOpt(130, nil) 365} 366 367// Specifies that this transaction should be treated as highest priority and that lower priority transactions should block behind this one. Use is discouraged outside of low-level tools 368func (o TransactionOptions) SetPrioritySystemImmediate() error { 369 return o.setOpt(200, nil) 370} 371 372// Specifies that this transaction should be treated as low priority and that default priority transactions will be processed first. Batch priority transactions will also be throttled at load levels smaller than for other types of transactions and may be fully cut off in the event of machine failures. Useful for doing batch work simultaneously with latency-sensitive work 373func (o TransactionOptions) SetPriorityBatch() error { 374 return o.setOpt(201, nil) 375} 376 377// This is a write-only transaction which sets the initial configuration. This option is designed for use by database system tools only. 378func (o TransactionOptions) SetInitializeNewDatabase() error { 379 return o.setOpt(300, nil) 380} 381 382// Allows this transaction to read and modify system keys (those that start with the byte 0xFF) 383func (o TransactionOptions) SetAccessSystemKeys() error { 384 return o.setOpt(301, nil) 385} 386 387// Allows this transaction to read system keys (those that start with the byte 0xFF) 388func (o TransactionOptions) SetReadSystemKeys() error { 389 return o.setOpt(302, nil) 390} 391 392// Not yet implemented. 393func (o TransactionOptions) SetDebugRetryLogging(param string) error { 394 return o.setOpt(401, []byte(param)) 395} 396 397// Deprecated 398// 399// Parameter: String identifier to be used in the logs when tracing this transaction. The identifier must not exceed 100 characters. 400func (o TransactionOptions) SetTransactionLoggingEnable(param string) error { 401 return o.setOpt(402, []byte(param)) 402} 403 404// Sets a client provided identifier for the transaction that will be used in scenarios like tracing or profiling. Client trace logging or transaction profiling must be separately enabled. 405// 406// Parameter: String identifier to be used when tracing or profiling this transaction. The identifier must not exceed 100 characters. 407func (o TransactionOptions) SetDebugTransactionIdentifier(param string) error { 408 return o.setOpt(403, []byte(param)) 409} 410 411// Enables tracing for this transaction and logs results to the client trace logs. The DEBUG_TRANSACTION_IDENTIFIER option must be set before using this option, and client trace logging must be enabled and to get log output. 412func (o TransactionOptions) SetLogTransaction() error { 413 return o.setOpt(404, nil) 414} 415 416// Set a timeout in milliseconds which, when elapsed, will cause the transaction automatically to be cancelled. Valid parameter values are ``[0, INT_MAX]``. If set to 0, will disable all timeouts. All pending and any future uses of the transaction will throw an exception. The transaction can be used again after it is reset. Prior to API version 610, like all other transaction options, the timeout must be reset after a call to ``onError``. If the API version is 610 or greater, the timeout is not reset after an ``onError`` call. This allows the user to specify a longer timeout on specific transactions than the default timeout specified through the ``transaction_timeout`` database option without the shorter database timeout cancelling transactions that encounter a retryable error. Note that at all API versions, it is safe and legal to set the timeout each time the transaction begins, so most code written assuming the older behavior can be upgraded to the newer behavior without requiring any modification, and the caller is not required to implement special logic in retry loops to only conditionally set this option. 417// 418// Parameter: value in milliseconds of timeout 419func (o TransactionOptions) SetTimeout(param int64) error { 420 b, e := int64ToBytes(param) 421 if e != nil { 422 return e 423 } 424 return o.setOpt(500, b) 425} 426 427// Set a maximum number of retries after which additional calls to ``onError`` will throw the most recently seen error code. Valid parameter values are ``[-1, INT_MAX]``. If set to -1, will disable the retry limit. Prior to API version 610, like all other transaction options, the retry limit must be reset after a call to ``onError``. If the API version is 610 or greater, the retry limit is not reset after an ``onError`` call. Note that at all API versions, it is safe and legal to set the retry limit each time the transaction begins, so most code written assuming the older behavior can be upgraded to the newer behavior without requiring any modification, and the caller is not required to implement special logic in retry loops to only conditionally set this option. 428// 429// Parameter: number of times to retry 430func (o TransactionOptions) SetRetryLimit(param int64) error { 431 b, e := int64ToBytes(param) 432 if e != nil { 433 return e 434 } 435 return o.setOpt(501, b) 436} 437 438// Set the maximum amount of backoff delay incurred in the call to ``onError`` if the error is retryable. Defaults to 1000 ms. Valid parameter values are ``[0, INT_MAX]``. If the maximum retry delay is less than the current retry delay of the transaction, then the current retry delay will be clamped to the maximum retry delay. Prior to API version 610, like all other transaction options, the maximum retry delay must be reset after a call to ``onError``. If the API version is 610 or greater, the retry limit is not reset after an ``onError`` call. Note that at all API versions, it is safe and legal to set the maximum retry delay each time the transaction begins, so most code written assuming the older behavior can be upgraded to the newer behavior without requiring any modification, and the caller is not required to implement special logic in retry loops to only conditionally set this option. 439// 440// Parameter: value in milliseconds of maximum delay 441func (o TransactionOptions) SetMaxRetryDelay(param int64) error { 442 b, e := int64ToBytes(param) 443 if e != nil { 444 return e 445 } 446 return o.setOpt(502, b) 447} 448 449// Snapshot read operations will see the results of writes done in the same transaction. This is the default behavior. 450func (o TransactionOptions) SetSnapshotRywEnable() error { 451 return o.setOpt(600, nil) 452} 453 454// Snapshot read operations will not see the results of writes done in the same transaction. This was the default behavior prior to API version 300. 455func (o TransactionOptions) SetSnapshotRywDisable() error { 456 return o.setOpt(601, nil) 457} 458 459// The transaction can read and write to locked databases, and is resposible for checking that it took the lock. 460func (o TransactionOptions) SetLockAware() error { 461 return o.setOpt(700, nil) 462} 463 464// By default, operations that are performed on a transaction while it is being committed will not only fail themselves, but they will attempt to fail other in-flight operations (such as the commit) as well. This behavior is intended to help developers discover situations where operations could be unintentionally executed after the transaction has been reset. Setting this option removes that protection, causing only the offending operation to fail. 465func (o TransactionOptions) SetUsedDuringCommitProtectionDisable() error { 466 return o.setOpt(701, nil) 467} 468 469// The transaction can read from locked databases. 470func (o TransactionOptions) SetReadLockAware() error { 471 return o.setOpt(702, nil) 472} 473 474// This option should only be used by tools which change the database configuration. 475func (o TransactionOptions) SetUseProvisionalProxies() error { 476 return o.setOpt(711, nil) 477} 478 479type StreamingMode int 480 481const ( 482 483 // Client intends to consume the entire range and would like it all 484 // transferred as early as possible. 485 StreamingModeWantAll StreamingMode = -1 486 487 // The default. The client doesn't know how much of the range it is likely 488 // to used and wants different performance concerns to be balanced. Only a 489 // small portion of data is transferred to the client initially (in order to 490 // minimize costs if the client doesn't read the entire range), and as the 491 // caller iterates over more items in the range larger batches will be 492 // transferred in order to minimize latency. 493 StreamingModeIterator StreamingMode = 0 494 495 // Infrequently used. The client has passed a specific row limit and wants 496 // that many rows delivered in a single batch. Because of iterator operation 497 // in client drivers make request batches transparent to the user, consider 498 // ``WANT_ALL`` StreamingMode instead. A row limit must be specified if this 499 // mode is used. 500 StreamingModeExact StreamingMode = 1 501 502 // Infrequently used. Transfer data in batches small enough to not be much 503 // more expensive than reading individual rows, to minimize cost if 504 // iteration stops early. 505 StreamingModeSmall StreamingMode = 2 506 507 // Infrequently used. Transfer data in batches sized in between small and 508 // large. 509 StreamingModeMedium StreamingMode = 3 510 511 // Infrequently used. Transfer data in batches large enough to be, in a 512 // high-concurrency environment, nearly as efficient as possible. If the 513 // client stops iteration early, some disk and network bandwidth may be 514 // wasted. The batch size may still be too small to allow a single client to 515 // get high throughput from the database, so if that is what you need 516 // consider the SERIAL StreamingMode. 517 StreamingModeLarge StreamingMode = 4 518 519 // Transfer data in batches large enough that an individual client can get 520 // reasonable read bandwidth from the database. If the client stops 521 // iteration early, considerable disk and network bandwidth may be wasted. 522 StreamingModeSerial StreamingMode = 5 523) 524 525// Performs an addition of little-endian integers. If the existing value in the database is not present or shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. The integers to be added must be stored in a little-endian representation. They can be signed in two's complement representation or unsigned. You can add to an integer at a known offset in the value by prepending the appropriate number of zero bytes to ``param`` and padding with zero bytes to match the length of the value. However, this offset technique requires that you know the addition will not cause the integer field within the value to overflow. 526func (t Transaction) Add(key KeyConvertible, param []byte) { 527 t.atomicOp(key.FDBKey(), param, 2) 528} 529 530// Deprecated 531func (t Transaction) And(key KeyConvertible, param []byte) { 532 t.atomicOp(key.FDBKey(), param, 6) 533} 534 535// Performs a bitwise ``and`` operation. If the existing value in the database is not present, then ``param`` is stored in the database. If the existing value in the database is shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. 536func (t Transaction) BitAnd(key KeyConvertible, param []byte) { 537 t.atomicOp(key.FDBKey(), param, 6) 538} 539 540// Deprecated 541func (t Transaction) Or(key KeyConvertible, param []byte) { 542 t.atomicOp(key.FDBKey(), param, 7) 543} 544 545// Performs a bitwise ``or`` operation. If the existing value in the database is not present or shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. 546func (t Transaction) BitOr(key KeyConvertible, param []byte) { 547 t.atomicOp(key.FDBKey(), param, 7) 548} 549 550// Deprecated 551func (t Transaction) Xor(key KeyConvertible, param []byte) { 552 t.atomicOp(key.FDBKey(), param, 8) 553} 554 555// Performs a bitwise ``xor`` operation. If the existing value in the database is not present or shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. 556func (t Transaction) BitXor(key KeyConvertible, param []byte) { 557 t.atomicOp(key.FDBKey(), param, 8) 558} 559 560// Appends ``param`` to the end of the existing value already in the database at the given key (or creates the key and sets the value to ``param`` if the key is empty). This will only append the value if the final concatenated value size is less than or equal to the maximum value size (i.e., if it fits). WARNING: No error is surfaced back to the user if the final value is too large because the mutation will not be applied until after the transaction has been committed. Therefore, it is only safe to use this mutation type if one can guarantee that one will keep the total value size under the maximum size. 561func (t Transaction) AppendIfFits(key KeyConvertible, param []byte) { 562 t.atomicOp(key.FDBKey(), param, 9) 563} 564 565// Performs a little-endian comparison of byte strings. If the existing value in the database is not present or shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. The larger of the two values is then stored in the database. 566func (t Transaction) Max(key KeyConvertible, param []byte) { 567 t.atomicOp(key.FDBKey(), param, 12) 568} 569 570// Performs a little-endian comparison of byte strings. If the existing value in the database is not present, then ``param`` is stored in the database. If the existing value in the database is shorter than ``param``, it is first extended to the length of ``param`` with zero bytes. If ``param`` is shorter than the existing value in the database, the existing value is truncated to match the length of ``param``. The smaller of the two values is then stored in the database. 571func (t Transaction) Min(key KeyConvertible, param []byte) { 572 t.atomicOp(key.FDBKey(), param, 13) 573} 574 575// Transforms ``key`` using a versionstamp for the transaction. Sets the transformed key in the database to ``param``. The key is transformed by removing the final four bytes from the key and reading those as a little-Endian 32-bit integer to get a position ``pos``. The 10 bytes of the key from ``pos`` to ``pos + 10`` are replaced with the versionstamp of the transaction used. The first byte of the key is position 0. A versionstamp is a 10 byte, unique, monotonically (but not sequentially) increasing value for each committed transaction. The first 8 bytes are the committed version of the database (serialized in big-Endian order). The last 2 bytes are monotonic in the serialization order for transactions. WARNING: At this time, versionstamps are compatible with the Tuple layer only in the Java, Python, and Go bindings. Also, note that prior to API version 520, the offset was computed from only the final two bytes rather than the final four bytes. 576func (t Transaction) SetVersionstampedKey(key KeyConvertible, param []byte) { 577 t.atomicOp(key.FDBKey(), param, 14) 578} 579 580// Transforms ``param`` using a versionstamp for the transaction. Sets the ``key`` given to the transformed ``param``. The parameter is transformed by removing the final four bytes from ``param`` and reading those as a little-Endian 32-bit integer to get a position ``pos``. The 10 bytes of the parameter from ``pos`` to ``pos + 10`` are replaced with the versionstamp of the transaction used. The first byte of the parameter is position 0. A versionstamp is a 10 byte, unique, monotonically (but not sequentially) increasing value for each committed transaction. The first 8 bytes are the committed version of the database (serialized in big-Endian order). The last 2 bytes are monotonic in the serialization order for transactions. WARNING: At this time, versionstamps are compatible with the Tuple layer only in the Java, Python, and Go bindings. Also, note that prior to API version 520, the versionstamp was always placed at the beginning of the parameter rather than computing an offset. 581func (t Transaction) SetVersionstampedValue(key KeyConvertible, param []byte) { 582 t.atomicOp(key.FDBKey(), param, 15) 583} 584 585// Performs lexicographic comparison of byte strings. If the existing value in the database is not present, then ``param`` is stored. Otherwise the smaller of the two values is then stored in the database. 586func (t Transaction) ByteMin(key KeyConvertible, param []byte) { 587 t.atomicOp(key.FDBKey(), param, 16) 588} 589 590// Performs lexicographic comparison of byte strings. If the existing value in the database is not present, then ``param`` is stored. Otherwise the larger of the two values is then stored in the database. 591func (t Transaction) ByteMax(key KeyConvertible, param []byte) { 592 t.atomicOp(key.FDBKey(), param, 17) 593} 594 595// Performs an atomic ``compare and clear`` operation. If the existing value in the database is equal to the given value, then given key is cleared. 596func (t Transaction) CompareAndClear(key KeyConvertible, param []byte) { 597 t.atomicOp(key.FDBKey(), param, 20) 598} 599 600type conflictRangeType int 601 602const ( 603 604 // Used to add a read conflict range 605 conflictRangeTypeRead conflictRangeType = 0 606 607 // Used to add a write conflict range 608 conflictRangeTypeWrite conflictRangeType = 1 609) 610 611type ErrorPredicate int 612 613const ( 614 615 // Returns ``true`` if the error indicates the operations in the 616 // transactions should be retried because of transient error. 617 ErrorPredicateRetryable ErrorPredicate = 50000 618 619 // Returns ``true`` if the error indicates the transaction may have 620 // succeeded, though not in a way the system can verify. 621 ErrorPredicateMaybeCommitted ErrorPredicate = 50001 622 623 // Returns ``true`` if the error indicates the transaction has not 624 // committed, though in a way that can be retried. 625 ErrorPredicateRetryableNotCommitted ErrorPredicate = 50002 626) 627