コード例 #1
0
        internal override void Visit(UploadVersionRequest req)
        {
            VersionEntry ve = this.GetVersionEntryByKey(req.TableId, req.RecordKey, req.VersionKey, req.LocalVerEntry);

            if (ve == null)
            {
                this.CQLExecute(string.Format(PartitionedCassandraVersionTable.CQL_UPLOAD_VERSION_ENTRY,
                                              req.TableId,
                                              req.RecordKey.ToString(),
                                              req.VersionEntry.VersionKey,
                                              req.VersionEntry.BeginTimestamp,
                                              req.VersionEntry.EndTimestamp,
                                              BytesSerializer.ToHexString(BytesSerializer.Serialize(req.VersionEntry.Record)),
                                              req.VersionEntry.TxId,
                                              req.VersionEntry.MaxCommitTs));
                req.RemoteVerEntry = req.VersionEntry;
                req.Result         = true;
            }
            else        // write-write conflict
            {
                req.RemoteVerEntry = req.VersionEntry;
                req.Result         = false;
            }

            req.Finished = true;
        }
コード例 #2
0
 internal override void Visit(ReplaceWholeVersionRequest req)
 {
     this.CQLExecute(string.Format(PartitionedCassandraVersionTable.CQL_REPLACE_WHOLE_VERSION,
                                   req.TableId, req.VersionEntry.BeginTimestamp, req.VersionEntry.EndTimestamp,
                                   BytesSerializer.ToHexString(BytesSerializer.Serialize(req.VersionEntry.Record)),
                                   req.VersionEntry.TxId, req.VersionEntry.MaxCommitTs,
                                   req.RecordKey.ToString(), req.VersionEntry.VersionKey));
     req.Result   = 1L;
     req.Finished = true;
 }
コード例 #3
0
        internal override void Visit(UploadVersionRequest req)
        {
            bool applied = this.CQLExecuteWithIfApplied(string.Format(CassandraVersionTable.CQL_UPLOAD_VERSION_ENTRY,
                                                                      req.TableId,
                                                                      req.RecordKey.ToString(),
                                                                      req.VersionEntry.VersionKey,
                                                                      req.VersionEntry.BeginTimestamp,
                                                                      req.VersionEntry.EndTimestamp,
                                                                      BytesSerializer.ToHexString(BytesSerializer.Serialize(req.VersionEntry.Record)),
                                                                      req.VersionEntry.TxId,
                                                                      req.VersionEntry.MaxCommitTs));

            req.Result   = applied ? 1L : 0L;
            req.Finished = true;
        }
コード例 #4
0
        internal override void Visit(InitiGetVersionListRequest req)
        {
            VersionEntry emptyEntry = VersionEntry.InitEmptyVersionEntry();

            this.CQLExecute(string.Format(PartitionedCassandraVersionTable.CQL_UPLOAD_VERSION_ENTRY,
                                          req.TableId,
                                          req.RecordKey.ToString(),
                                          emptyEntry.VersionKey,
                                          emptyEntry.BeginTimestamp,
                                          emptyEntry.EndTimestamp,
                                          BytesSerializer.ToHexString(BytesSerializer.Serialize(emptyEntry.Record)),
                                          emptyEntry.TxId,
                                          emptyEntry.MaxCommitTs));
            req.Result   = true;
            req.Finished = true;
        }