public sealed class TransactionOptions.Types.ReadOnly : IMessage<TransactionOptions.Types.ReadOnly>, IEquatable<TransactionOptions.Types.ReadOnly>, IDeepCloneable<TransactionOptions.Types.ReadOnly>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Spanner v1 API class TransactionOptions.Types.ReadOnly.
Executes all reads at a timestamp that is exact_staleness
old. The timestamp is chosen soon after the read is started.
Guarantees that all writes that have committed more than the
specified number of seconds ago are visible. Because Cloud Spanner
chooses the exact timestamp, this mode works even if the client's
local clock is substantially skewed from Cloud Spanner commit
timestamps.
Useful for reading at nearby replicas without the distributed
timestamp negotiation overhead of max_staleness.
Read data at a timestamp >= NOW - max_staleness
seconds. Guarantees that all writes that have committed more
than the specified number of seconds ago are visible. Because
Cloud Spanner chooses the exact timestamp, this mode works even if
the client's local clock is substantially skewed from Cloud Spanner
commit timestamps.
Useful for reading the freshest data available at a nearby
replica, while bounding the possible staleness if the local
replica has fallen behind.
Note that this option can only be used in single-use
transactions.
Executes all reads at a timestamp >= min_read_timestamp.
This is useful for requesting fresher data than some previous
read, or data that is fresh enough to observe the effects of some
previously committed transaction whose timestamp is known.
Note that this option can only be used in single-use transactions.
A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds.
Example: "2014-10-02T15:01:23.045123456Z".
Executes all reads at the given timestamp. Unlike other modes,
reads at a specific timestamp are repeatable; the same read at
the same timestamp always returns the same data. If the
timestamp is in the future, the read will block until the
specified timestamp, modulo the read's deadline.
Useful for large scale consistent reads such as mapreduces, or
for coordinating many reads against a consistent snapshot of the
data.
A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds.
Example: "2014-10-02T15:01:23.045123456Z".
If true, the Cloud Spanner-selected read timestamp is included in
the [Transaction][google.spanner.v1.Transaction] message that describes
the transaction.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version available for \u003ccode\u003eTransactionOptions.Types.ReadOnly\u003c/code\u003e is 5.0.0-beta05, with several older versions also accessible.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTransactionOptions.Types.ReadOnly\u003c/code\u003e is a message type used to initiate a read-only transaction in the Google Cloud Spanner v1 API, implementing several interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, and \u003ccode\u003eIDeepCloneable\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis class offers properties to configure the timestamp for reads, including \u003ccode\u003eExactStaleness\u003c/code\u003e, \u003ccode\u003eMaxStaleness\u003c/code\u003e, \u003ccode\u003eMinReadTimestamp\u003c/code\u003e, and \u003ccode\u003eReadTimestamp\u003c/code\u003e, allowing for varied data consistency and staleness requirements.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eStrong\u003c/code\u003e property allows reading at a timestamp where all previously committed transactions are visible, while \u003ccode\u003eReturnReadTimestamp\u003c/code\u003e allows including the Spanner-selected read timestamp in the transaction message.\u003c/p\u003e\n"],["\u003cp\u003eThe class \u003ccode\u003eTransactionOptions.Types.ReadOnly\u003c/code\u003e has two constructors: \u003ccode\u003eReadOnly()\u003c/code\u003e and \u003ccode\u003eReadOnly(TransactionOptions.Types.ReadOnly other)\u003c/code\u003e to initialize it, and it contains read-only members like \u003ccode\u003eHasStrong\u003c/code\u003e and \u003ccode\u003eTimestampBoundCase\u003c/code\u003e to get the current state of the transaction.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Spanner v1 API - Class TransactionOptions.Types.ReadOnly (5.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/5.0.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.6.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.5.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.4.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.3.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.2.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.1.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.0.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.15.1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.15.1/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.14.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.13.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.12.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.11.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.10.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.9.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.8.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.7.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.6.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.5.0/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly) \n\n public sealed class TransactionOptions.Types.ReadOnly : IMessage\u003cTransactionOptions.Types.ReadOnly\u003e, IEquatable\u003cTransactionOptions.Types.ReadOnly\u003e, IDeepCloneable\u003cTransactionOptions.Types.ReadOnly\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Spanner v1 API class TransactionOptions.Types.ReadOnly.\n\nMessage type to initiate a read-only transaction. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e TransactionOptions.Types.ReadOnly \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[TransactionOptions](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions)[Types](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types)[ReadOnly](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[TransactionOptions](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions)[Types](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types)[ReadOnly](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[TransactionOptions](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions)[Types](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types)[ReadOnly](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Spanner.V1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Spanner.V1.dll\n\nConstructors\n------------\n\n### ReadOnly()\n\n public ReadOnly()\n\n### ReadOnly(ReadOnly)\n\n public ReadOnly(TransactionOptions.Types.ReadOnly other)\n\nProperties\n----------\n\n### ExactStaleness\n\n public Duration ExactStaleness { get; set; }\n\nExecutes all reads at a timestamp that is `exact_staleness`\nold. The timestamp is chosen soon after the read is started.\n\nGuarantees that all writes that have committed more than the\nspecified number of seconds ago are visible. Because Cloud Spanner\nchooses the exact timestamp, this mode works even if the client's\nlocal clock is substantially skewed from Cloud Spanner commit\ntimestamps.\n\nUseful for reading at nearby replicas without the distributed\ntimestamp negotiation overhead of `max_staleness`.\n\n### HasStrong\n\n public bool HasStrong { get; }\n\nGets whether the \"strong\" field is set\n\n### MaxStaleness\n\n public Duration MaxStaleness { get; set; }\n\nRead data at a timestamp \\\u003e= `NOW - max_staleness`\nseconds. Guarantees that all writes that have committed more\nthan the specified number of seconds ago are visible. Because\nCloud Spanner chooses the exact timestamp, this mode works even if\nthe client's local clock is substantially skewed from Cloud Spanner\ncommit timestamps.\n\nUseful for reading the freshest data available at a nearby\nreplica, while bounding the possible staleness if the local\nreplica has fallen behind.\n\nNote that this option can only be used in single-use\ntransactions.\n\n### MinReadTimestamp\n\n public Timestamp MinReadTimestamp { get; set; }\n\nExecutes all reads at a timestamp \\\u003e= `min_read_timestamp`.\n\nThis is useful for requesting fresher data than some previous\nread, or data that is fresh enough to observe the effects of some\npreviously committed transaction whose timestamp is known.\n\nNote that this option can only be used in single-use transactions.\n\nA timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds.\nExample: `\"2014-10-02T15:01:23.045123456Z\"`.\n\n### ReadTimestamp\n\n public Timestamp ReadTimestamp { get; set; }\n\nExecutes all reads at the given timestamp. Unlike other modes,\nreads at a specific timestamp are repeatable; the same read at\nthe same timestamp always returns the same data. If the\ntimestamp is in the future, the read will block until the\nspecified timestamp, modulo the read's deadline.\n\nUseful for large scale consistent reads such as mapreduces, or\nfor coordinating many reads against a consistent snapshot of the\ndata.\n\nA timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds.\nExample: `\"2014-10-02T15:01:23.045123456Z\"`.\n\n### ReturnReadTimestamp\n\n public bool ReturnReadTimestamp { get; set; }\n\nIf true, the Cloud Spanner-selected read timestamp is included in\nthe \\[Transaction\\]\\[google.spanner.v1.Transaction\\] message that describes\nthe transaction.\n\n### Strong\n\n public bool Strong { get; set; }\n\nRead at a timestamp where all previously committed transactions\nare visible.\n\n### TimestampBoundCase\n\n public TransactionOptions.Types.ReadOnly.TimestampBoundOneofCase TimestampBoundCase { get; }"]]