github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/protocol/storage-graph.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package protocol 4 5 // Save in on device node as PrimaryNode() but with PrimaryKey as sha3.256(PrimaryNode, SecondaryNode) in related GraphMediaTypeID. 6 // - One secondary key can exist to list all SecondaryNode for PrimaryNode. But in some cases it isn't practical e.g. all relation to a city. 7 // - On some requirements may need more secondary indexes e.g. all "act" relation for an actor to get all movies or vice versa 8 // But is it true to save these type of data as graph structure? Isn't it so simple to has dedicated media type? 9 // We think we must graph structure to store time sensitive data that a relation change over times. 10 // https://en.wikipedia.org/wiki/Graph_database 11 // https://stackoverflow.com/questions/43712490/time-based-graph-data-modeling 12 // https://www.researchgate.net/publication/324435978_Graph_based_Platform_for_Electricity_Market_Study_Education_and_Training 13 // https://github.com/milvus-io/milvus 14 type Graph interface { 15 PrimaryNode() [16]byte 16 SecondaryNode() [16]byte 17 Relation() GraphRelationLabel // Edge in graph data type 18 } 19 20 type GraphRelationLabel uint32 21 22 const ( 23 GraphRelationLabel_Unset GraphRelationLabel = iota 24 GraphRelationLabel_Knowns 25 // friend, FriendCircleOne(best-friend), brother, LIVES_IN, NATIONAL_OF, ... 26 )