MCPcopy Create free account
hub / github.com/apple/foundationdb / vector_example

Function vector_example

layers/containers/vector.py:527–546  ·  view source on GitHub ↗
(tr)

Source from the content-addressed store, hash-verified

525# caution: modifies the database!
526@fdb.transactional
527def vector_example(tr):
528 vector = Vector(Subspace(('my_vector',)), 0)
529
530 with vector.use_transaction(tr):
531 vector.clear()
532
533 for i in range(0, 5):
534 vector.push(i)
535
536 _print_vector(vector, tr)
537
538 print 'Pop last item: %d' % vector.pop()
539 _print_vector(vector, tr)
540
541 vector[1] = 10
542 vector.resize(11)
543 _print_vector(vector, tr)
544
545 vector.swap(1, 10)
546 _print_vector(vector, tr)
547
548
549def _print_vector(vector, tr):

Callers 1

vector.pyFile · 0.85

Calls 10

use_transactionMethod · 0.95
clearMethod · 0.95
pushMethod · 0.95
popMethod · 0.95
resizeMethod · 0.95
swapMethod · 0.95
VectorClass · 0.85
rangeFunction · 0.85
_print_vectorFunction · 0.85
SubspaceClass · 0.70

Tested by

no test coverage detected