Do I have to need implement the ContextStore.delete (scope) API?

#1

I'm very troubled now.
Do I have to need implement the ContextStore.delete (scope) API?

The ContextStore.delete (scope) API of the localfilesystem plugin was not called.
However, the ContextStore.delete (scope) API of the memory plugin was called.
I am creating a plugin store module for Persistent Context.

3 Likes

#2

If delete () is not called, it will work without implementing it. However, since it is a specification, I think it is better to implement it for the future.
Rather than that, I would like to know why delete () is not called when storage is not memory.

0 Likes

#3

Would it be a bug? Or not?
I would like to know why delete () is not called when storage is not memory.
https://github.com/node-red/node-red/blob/0.19.4/red/runtime/nodes/context/index.js
index

0 Likes

#4

Hi @kominami - my apologies for not responding to your earlier post on this.

Before 0.19, certain contexts would get deleted when new flows were deployed. We didn't want to change that behaviour for users who didn't enable the persistent context feature. Internally, that meant the new Memory context store was given the delete() function to enable this - and why it only gets called if no stores have been enabled.

I've been review our design notes to see where we ended up on the delete() function more generally. It is very important to note the design notes are working documents and not necessarily final design documents. In this case, the design note shows the intended API design was to have the delete() function as the only way to remove context.

However, during the implementation and testing phase, a concern was raised that if NR was started with a different flow configuration, it wouldn't know about the 'old' nodes/flows, so it wouldn't be able to delete there contexts. This would leave things lying around that weren't needed. This is why the clean() function was added. This gets called with a list of the known nodes/flows and allows the context store to clean out anything that's no longer needed. By introducing this function, the delete() function became largely redundant - other than as a special case for the Memory store. But looking at it now, we failed to properly reflect that in the design.

So what does that all mean...

I don't think you need to implement delete and I think we should remove it from the spec for the store interface. But I also want to make sure I'm not forgetting about some future plans for the store that would require the delete function.

0 Likes

#5

Dear @knolleary - Thank you for your reply.
My doubt was resolved.

0 Likes