Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silo #5

Closed
G0ldenSp00n-zz opened this issue Sep 14, 2018 · 1 comment
Closed

Silo #5

G0ldenSp00n-zz opened this issue Sep 14, 2018 · 1 comment
Assignees
Labels
core A core feature to be added to the code.
Milestone

Comments

@G0ldenSp00n-zz
Copy link
Collaborator

G0ldenSp00n-zz commented Sep 14, 2018

Silo

The Silo is used to store the state of the App. It is structured to be bound to the Component structure of the Application being implemented. This approach allows the Silo to maintain encapsulation of the data that it hold while still providing access to the data in a predictable way. The Silo is a collection of SiloNodes, each with their own set of subscribers and modifiers which act to update elements of the Silo in a predictable way.

SiloNode

A SiloNode is a structured element of the Silo. The structure of the Node allows for updates that propagate to all of the dependent subscribers, along with allowing the minimum amount of subscribers to be notified for each change.

SiloNode {
    value: {
       //ChildSiloNodes
    },
    modifiers: {
          modifier: //Code to Update Value
    },
    queue: [/* List of Modifiers To Be Implemented on Value*/],
    subscribers: [/* List of Components Subscribed to Node Updates */],
    parent: //ParentSiloNode
}

Modifiers

Modifiers act as the way to create predictable changes to the Silo in Radon. A modifier acts to perform some functionality before updating the value of a SiloNode and propagate the change to the Node's subscribers.

  function modifierName (current, payload) {
    return current + payload; //Changes the Node Value and Notifies Subscribers
  }

Object Modifiers

SiloNodes that own a set of predictable Objects, which all may need similar modifiers can implement a special modifier which acts on individual children that it controls. This modifier takes an extra parameter, a key which tells the modifier which child it should run the modifier on.

  function modifierName (current, key, payload) {
    /* currentValue is the Value of the Child Selected with the Key Parameter. */
    return current + payload; //Changes the Child Node Value and Notifies the Child's Subscribers
}

Silo Structuring

The Silo is structured into a tree as a means of providing encapsulation to state management. This tree structure binds to the Component Tree in order to pass props to each element that requires them. This connection between the State Tree and the Component Tree means that each Component will only get access to its parent's state, and the state that it holds, while being prevented from accessing the state of its sibling components.

Async Queue

The Async Queue is the way that Radon handles asynchronous changes to the Silo. When a modifier is run on a SiloNode that requires an asynchronous event, they are added to a queue. If another modifier seeks to update the SiloNode before the asynchronous change has updated the value and propagated the change, it will be added to the queue behind the asynchronous function. This allow SiloNode changes to happen asynchronously in a predictable manner.

@G0ldenSp00n-zz G0ldenSp00n-zz added this to the MVP milestone Sep 14, 2018
G0ldenSp00n-zz pushed a commit that referenced this issue Sep 14, 2018
Async Queue from #5 Finished
This was referenced Sep 15, 2018
Closed
Merged
@G0ldenSp00n-zz
Copy link
Collaborator Author

Finished Silo Core Functionality

@G0ldenSp00n-zz G0ldenSp00n-zz added the core A core feature to be added to the code. label Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core A core feature to be added to the code.
Projects
None yet
Development

No branches or pull requests

2 participants