activity icon indicating copy to clipboard operation
activity copied to clipboard

Clarification: can pub.Database.GetInbox and pub.Database.GetOutbox return an empty collection?

Open BenLubar opened this issue 5 years ago • 1 comments

Is there any downside to returning an empty collection from GetInbox and GetOutbox without even checking the database? The documentation implies that these functions are only used as a source for a collection object to pass to SetInbox and SetOutbox, and that the modified content will always be additive when used with these two methods.

BenLubar avatar Aug 11 '20 16:08 BenLubar

You're correct, the GetInbox and GetOutbox on the database is for its own SetInbox and SetOutbox. go-fed will prepend any IRIs to any existing orderedItems property. If you return an OrderedCollection with no orderedItems property, it should create a new one.

Note that the GetInbox on FederatingProtocol and GetOutbox on the CommonBehavior are meant for handling the HTTP requests from peers and sending a OrderedCollection or OrderedCollectionPage in the response.

I'm open to suggestions on improvements (API, documentation, etc).

cjslep avatar Aug 12 '20 06:08 cjslep