MCPcopy Create free account
hub / github.com/baidu/tera / put_get_with_timestamp

Function put_get_with_timestamp

src/sdk/python/sample.py:181–208  ·  view source on GitHub ↗

put get with timestamp

(table)

Source from the content-addressed store, hash-verified

179
180
181def put_get_with_timestamp(table):
182 """ put get with timestamp """
183 print("\nput_get_with_timestamp")
184 key = "nput_get_with_timestamp"
185 mu = table.NewRowMutation(key)
186 mu.PutWithTimestamp("cf0", "qu0", 42, "value")
187 table.ApplyMutation(mu)
188 while not table.IsPutFinished():
189 time.sleep(0.01)
190
191 reader = table.NewRowReader(key)
192 reader.AddColumn("cf0", "qu0")
193 table.ApplyReader(reader)
194 while not table.IsGetFinished():
195 time.sleep(0.01)
196
197 status = reader.GetStatus()
198 if status.GetReasonNumber() != Status.OK:
199 print(status.GetReasonString())
200 return
201 while not reader.Done():
202 row = reader.RowKey()
203 column = reader.Family() + ":" + reader.Qualifier()
204 timestamp = str(reader.Timestamp())
205 assert reader.Timestamp() == 42
206 val = reader.Value()
207 print row + ":" + column + ":" + timestamp + ":" + val
208 reader.Next()
209
210
211def put_get_int64(table, rowkey, cf, qu, value):

Callers 1

mainFunction · 0.85

Calls 15

PutWithTimestampMethod · 0.80
ApplyReaderMethod · 0.80
GetReasonNumberMethod · 0.80
GetReasonStringMethod · 0.80
NewRowMutationMethod · 0.45
ApplyMutationMethod · 0.45
IsPutFinishedMethod · 0.45
NewRowReaderMethod · 0.45
AddColumnMethod · 0.45
IsGetFinishedMethod · 0.45
GetStatusMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected