Closed antho1404 closed 5 years ago
Probably related to the service db, the service db should have a real has many relation.
sid => [hash1, hash2, ...]
hash1 => service_definition
hash2 => service_definition
for now we have
sid => hash1
hash1 => service_definition
hash2 => service_definition
We are loosing some informations and also the All
function is getting the hash first instead of the sid.
We should have
res = []
for all sid
hashes = get_hashes_of_sid(sid)
hash = get_last_hash(hashes)
def = get_definition(hash)
append(res, def)
return res
Now we have
res = []
for all hash
def = get_definition(hash)
append(res, def)
return res
If I deploy 2 services that have the same sid but generate different hashes (different versions), this generate 2 different sid with the same name, this should not be possible
It's a feature actually. The sid you get from the command service list
are not the index in the database but simply the Sid
parameter in the Service
struct.
for now we have
sid => hash1 hash1 => service_definition hash2 => service_definition
This is not true. The current implementation always replace the link from sid to hash with the latest deploy service:
So, it's actually:
sid => hash2
hash1 => service_definition
hash2 => service_definition
Otherwise, yes we should implement the one to many relation between sid and hashes (in a separated db i would recommend) in a "add on top" way, so the latest added hash is the first element of the one to many relation (will be easier I think to get the latest).
It's a feature actually
That's a really confusing feature... Sid is the entry point to the last version of the service so it's quite confusing when you have multiple entry point
@antho1404 i think we can close because https://github.com/mesg-foundation/core/pull/839 has been merged
If I deploy 2 services that have the same sid but generate different hashes (different versions), this generate 2 different sid with the same name, this should not be possible
We should only have access to one sid and not multiple
Step to reproduce:
./dev-cli service delete --all
./dev-cli service deploy https://github.com/mesg-foundation/service-ethereum/archive/master.tar.gz
(one sid and one hash)./dev-cli service deploy https://github.com/mesg-foundation/service-ethereum
./dev-cli service list
This should generate only one line but it generates two lines with the same sid