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

Method Get

src/sdk/python/TeraSdk.py:539–562  ·  view source on GitHub ↗

同步get一个cell的值 Args: rowkey(string): Rowkey的值 cf(string): ColumnFamily名 qu(string): Qualifier名 snapshot(long): 快照,不关心的用户设置为0即可 Returns: (string) cell的值 Raises: TeraSdkException: 读操作失败

(self, rowkey, cf, qu, snapshot=0)

Source from the content-addressed store, hash-verified

537 lib.tera_table_apply_reader_batch(self.table, reader_array, num)
538
539 def Get(self, rowkey, cf, qu, snapshot=0):
540 """ 同步get一个cell的值
541
542 Args:
543 rowkey(string): Rowkey的值
544 cf(string): ColumnFamily名
545 qu(string): Qualifier名
546 snapshot(long): 快照,不关心的用户设置为0即可
547 Returns:
548 (string) cell的值
549 Raises:
550 TeraSdkException: 读操作失败
551 """
552 err = c_char_p()
553 value = POINTER(c_ubyte)()
554 vallen = c_uint64()
555 result = lib.tera_table_get(
556 self.table, rowkey, c_uint64(len(rowkey)), cf,
557 qu, c_uint64(len(qu)), byref(value), byref(vallen), byref(err),
558 c_uint64(snapshot)
559 )
560 if not result:
561 raise TeraSdkException("get record failed:" + err.value)
562 return copy_string_to_user(value, long(vallen.value))
563
564 def GetInt64(self, rowkey, cf, qu, snapshot):
565 """ 类同Get()接口,区别是将cell的内容作为int64计数器返回

Callers 3

sync_getFunction · 0.45
NativeGetFunction · 0.45
NativeApplyReaderFunction · 0.45

Calls 2

TeraSdkExceptionClass · 0.85
copy_string_to_userFunction · 0.85

Tested by

no test coverage detected