eos icon indicating copy to clipboard operation
eos copied to clipboard

confused about the purpose of the scope for instantiating a multi_index

Open GeneSourceCode opened this issue 8 years ago • 6 comments

I am confused about the purpose of scope which is the an argument of multi_index constructor. if the scope serves the same as its name suggests, the instantiated table should only contain records whose attribute used for index matches the scope value. But actually, the whole table is still accessible. So, what is the purpose for scope?

GeneSourceCode avatar Jun 09 '18 09:06 GeneSourceCode

index and scope are different. If you add a row using one scope then read rows using a different scope, they won't show up.

tbfleming avatar Jun 09 '18 15:06 tbfleming

@tbfleming which attribute is used for scope? where is it defined? at the record struct or at multi_index table?

GeneSourceCode avatar Jun 09 '18 20:06 GeneSourceCode

It's a multi_index constructor argument

tbfleming avatar Jun 09 '18 20:06 tbfleming

can the scope be any type of object?

breadbread1984 avatar Jun 10 '18 14:06 breadbread1984

the scope is a uint64_t

tbfleming avatar Jun 10 '18 15:06 tbfleming

thx

GeneSourceCode avatar Jun 11 '18 01:06 GeneSourceCode