orbitdb
orbitdb copied to clipboard
Open DB with address without path/name part
This PR is supposed to fix the TODO in the Road to 1.0 Issue, to permit opening a db with an address, that does not have the name/path part.
Related project: User Experience Improvements
This PR also changes the tests to expect this new behavior.
Remove the need for a database name and just use the CID as the address. Move everything else to the manifest (which already contains the name of the database).
I believe this is what this PR is trying to address :wink:
However the intended meaning I think is something different than what these commits do.
Currently an orbit-db address is made of 3 parts.
Here's an example orbit-db-address: /orbitdb/zdpuAyF2H2QAdRXEHw5U7WcMtvaorm2Qny7LjnfAtTAodDsd8/example
It looks like a unix path. The first part of the path, orbitdb, is there so its easy to know its an orbit-db address. The second part is the ipfs CID of the database manifest, which contains some important information for opening and running the database; more info here. The third part, in our case example, is the name of the database and is the only part of the address directly chosen by the user.
The suggested improvement from the Road to 1.0 is to remove the third part from the address (and possibly remove everything but the ipfs CID). The name is already part of the database manifest so it still exists and we wouldn't have to worry about addresses being edited to have the wrong name which would simplify code a bit.
Changing the address is changing the protocol which could break compatibility with older versions. If the changes introduce a breaking change expect them to be held until the 1.0 release which has an unexpected time of arrival (but maybe in the next few months). Feel free to continue working on this improvement in this pr or closing this pr and opening a new one.
What this PR does is exactly this: It makes the name part of the orbitdb address optional while still permitting the use of older addresses.
Internally the name part of the addresses is always disregarded and instead the name stored in the manifest is used.
Thus this PR is not breaking anything for the users, but allows for users to omit the last part of the OrbitDB Address.
It makes the name part of the orbitdb address optional while still permitting the use of older addresses.
This is great, support for older addresses and backward compatibility is important. At the same time I think its better to not have any new addresses until 1.0 even though you haven't really changed the address at all.
Also I prefer the behavior of erroring if the name exists in the address and is incorrect.
I believe the reasons for this improvement being suggested is how the orbitdb address is used as a unique key to refer to the database like is done here and simplifying the addresses in general, but I'm not sure. It's probably best to find out the reasons for this suggested change and see if its worth. From looking at the phrasing in the Road to 1.0 issue again it seems like the author is suggesting removing everything from the address but the ipfs CID.
Personally I'm not convinced changing the address format is useful but I'd love to hear why it is. All the reasons I can think of can be handled by using the address.root as the address internally and I think its valuable for databases to be differentiated by humans somewhat easily.
I think its valuable for databases to be differentiated by humans somewhat easily. That's true. But it is also true, that in cases where the OrbitDB Address is only used by a machine both the
pathand/orbitdb/part may be unnecessary.
What is currently missing from OrbitDB (in my opinion) is a function to convert a manifest CID to OrbitDB Address and vice versa.
If this PR is still valid, please check against version 1 release.