s-kostyuk / everpl Goto Github PK
View Code? Open in Web Editor NEWThe Everthing Platfrom source code
Home Page: https://everpl.readthedocs.io/
License: MIT License
The Everthing Platfrom source code
Home Page: https://everpl.readthedocs.io/
License: MIT License
Implements a set of aspects or middlewares that will:
Blocked by #61
Introduce REST API versioning, stabilize basic API, release v1 of API.
Implement a module for caching of API responses.
It must to analyze 'last_updated' field of cached resourses, calculate ETags (or generate some other value that can be used as ETag) and set corresponding HTTP headers
Implement a support of filtering for Things (items in /things/
REST API endpoint).
Parameter-based filtering is proposed. To filter all things by their placement, the following request will be able to be used:
curl --request GET \
--url 'http://dpl_host:dpl_port/things/?placement=R1' \
--header 'Authorization: your_auth_token_here'
In support of filtering approach, based on query parameters, see the following descriptions and mentions:
For now not all classes from object model have an identifier as a property. Objects of Placement class store their identifiers "placement_id" property, objects of Thing - in "metadata" dictionary as a value of "id" key and Connections don't have identifiers at all.
So, it's time to make some consistency in structure of all object model classes and to add an "domain_id" property
Introduce a database for storing of configurations of all Things in the system. Replace current config-file configurations of Things with DB alternatives
So, the subtasks:
Related to #29
Looks like we need to switch from current home-brew architecture to almost classical architecture with separate Repositories and Services.
For now the functionality of Services is entrusted to such entity as "ApiGateway". It control almost everything related to the of processing requests coming into different API implementations (like RestApi implementation). There is no separation of responsibilities between services based on functionality and a set of related objects.
The functionality of Repositories is entrusted to PlacementManager and BindingManager. Those two managers store and control access to Placements (the first one), Connections and Things (second one). Also they perform a small subset of functions usually entrusted to services like enabling and disabling of Things.
The last aspect to consider is a possibility to switch to Redis, SQLite or other lightweight databases for storing of persistent data (like settings of Things and Connections, like a set of Placements and Users and so on).
Considering all mentioned information, to facilitate further development of the platform, the following decision was made:
Prepare proper documentation for:
Platform
, Connection
and Thing
Separate all functions of Things to the separate interfaces ("capabilities") like:
and so on
Add handling of OPTIONS requests for things
and placements
endpoints. Otherwise preflight will fail and it will be unable to read any data from server from host another than the platform host itself
Choose one of the ways of version single-sourcing, either described in this document or an own one: https://packaging.python.org/guides/single-sourcing-package-version/
Review a structure of platform's configuration, their placement in file system and file format
Add missing unit tests for different classes that was present in v0.1 of this application
utils
auth
ApiGateway
RestApi
integrations
infrastructure (Registry
)PlacementBuilder
This task will be a quite hard. The list of available libraries is very limited. Maybe the best one is Cling written in Java. It's used by BubbleUPnP and other good applications. The second one is libupnp written in C. There are also Intel Leyna, Platinum UPnP and dlnap.
But. There is only one ready-made Python implementation - Coherence. It's abandoned now. And wasn't updated for a very long time.
Description to be filled
Announce presense of adpl server in local network via zeroconf (avahi)
See also:
Implement basic support of thing discovery mechanism. Create base classes and factories, create example platform-specific implementation
Description to be filled
Choose some AOP framework to be able to:
So, some sort of middleware is needed to perform such tasks prettily
If you need a support of python versions older than 3.5 - please, endorse this issue.
Implement a sort of event bus which will gather all changes and other events of the system. And, in future, will be able to send events to corresponding handlers, notify client devices and save events to DB.
Description to be filled
Add a possibility to start the platform in the "safe" mode.
In the safe mode all optional components of the system are disabled, i.e. all integrations, all features like push notifications and everything else that can be disabled. The only thing that will left working is a user interface with an ability to enable / disable components and integrations, edit some settings and to do anything else to rescue the system
Description to be filled
Update all error messages to the new format as described in documentation.
Create a new Service which will manage user authentication, access token management, access control and policies
UPD:
OK, there are some things to do:
Replace a UserManager class with a corresponding UserRepository -- UserService combination
As was stated in #61 (comment), Interceptor pattern will be used to implement a support of Aspects in everpl.
So, here is the task:
Create a class of objects that will be used for dynamic weaving of existing objects (instances), will mimic an interface of a weaved object, intercept all calls to the public methods (excluding properties) and will call aspects before, after or instead of the original (wrapped) methods.
For now all commands to the Actuators are sent synchronously, in a blocking manner. As result, the whole platform (i.e. updates of a Thing state, HTTP request handling and so on) stuck until the execution of the requested command will be finished. It's not good and must to be fixed
Implement an Aspect that will control Authorization in the system. I.e. will check if the current user is able to (is authorized to) execute a requested action.
Use Python's Context Managers and a concept of Ambient Context for passing of authentication tokens, use Interceptor pattern as an implementation detail for controlling of calls to Services.
Blocked by #63
Implement an Aspect that will control opening and closing of transactions on each call to the methods of Services or of some other wrapped objects
Blocked by #63
For now ThingService lacks implementation of several important methods:
It's needed to finalize their signatures and implement them
The current custom-made token-based authorization scheme is quite similar to the same in OAuth. Current custom protocol is based on revocable access tokens that are unique to one instance of client application and one user of it. In near future it is planned to support different access scopes that restricts an availability to perform some requests and actions in the system.
But, if we'll look closely, OAuth protocol supports this functions already, by design. And provides some other neat features in addition.
So, in future (maybe, quite near future) it's likely that OAuth protocol support will be implemented in platform. And in somewhat distant future it's likely that OAuth protocol will replace a current custom one.
Implement a some sort of event
s from C#, add events like 'on_state_changed' to the base implementation of Actuator
For now a single class called RestApi contains an implementation of all request handling logic. It is connected directly to a god object called ApiGateway and uses its interface to process requests, return and alter data in the system.
The better approach is to have several views, when each of them will use exactly one Service class for its needs and will be responsible exactly for one set of resources like all /things/ or all /placements/
Implement a new subsystem which will store a list of registered users and will allow to control their access to system's resources in the future
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.