Smart Functions
Before you begin this section, you should have completed all of the basic lessons, or have a good understanding of Fluree schema and adding data.
Role of Smart Functions
Smart functions are the engine for setting permissions in Fluree.
Every time a transaction is issued, that transaction might trigger various smart functions. In addition, when an end user (not a node) issues a query, various smart functions might be triggered.
Smart functions will either return true
or false
. If every smart function that is triggered returns true
, then the transaction will go through. If even one triggered smart function returns false
, then the transaction will fail, or in the case of a query- that piece of information will not be displayed to the user.
Smart functions are stored in the _fn
collection. From the _fn
collection, smart functions can be referenced in a variety of places. Functions stored in different locations are triggered in slightly different ways.