astarte-platform / astarte_core Goto Github PK
View Code? Open in Web Editor NEWAstarte platform core Elixir modules
License: Apache License 2.0
Astarte platform core Elixir modules
License: Apache License 2.0
The following endpoints are conflicting, but Astarte doesn't mark them as such:
/some/%{param}
/some/thing/here
They should be marked as overlapping since Astarte doesn't allow an endpoint that is a prefix of another one to be in the same interface, as it is reserved to be used to retrieve the endpoints collection (e.g. /some/thing
and /some/thing/here
are overlapping).
e.g. The following configuration: /some/thing/here
, /some/thing/there
, /some/thing/somewhere
would return:
{
"here": 1,
"there": 2,
"shomewhere": 42
}
Astarte is not reporting them as invalid but an error should be reported instead.
Users should be aware of this and avoid to add similar endpoint configurations to the their interfaces, since the behavior will be fixed in future Astarte releases.
Events sometimes contain an empty BSON document (e.g. %IncomingDataEvent{}
when triggered by an unset message). These are not correctly handled by Astarte.Core.Triggers.SimpleEvents.Encoder
and this results, for example, in a failure when TriggerEngine tries to serialize such an event.
I was wondering if is there a default ttl when using the use_ttl
database rentention policy?
I tried generating a malformed interface with the policy set to use_ttl
but missing the ttl
field. Inserting it with astartectl wasn't a problem and the interface returned without the ttl.
{
"interface_name": "com.Int",
"version_major": 0,
"version_minor": 1,
"type": "datastream",
"ownership": "device",
"aggregation": "individual",
"mappings": [
{
"endpoint": "/fooo",
"type": "double",
"reliability": "unreliable",
"retention": "discard",
"database_retention_policy": "use_ttl",
"explicit_timestamp": true
}
]
}
Here doesn't seem to check for the null value https://github.com/astarte-platform/astarte_core/blob/master/lib/astarte_core/mapping.ex#L227
When a BSON map containing well-formed binary values, e.g. <<18, 0, 0, 0, 5, 118, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0>>
, is passed to Cyanide 2.0 decode/1
(resulting in %{"v" => %Cyanide.Binary{subtype: :generic, data: <<1, 2, 3, 4, 5>>}}
and then to Astarte.Core.Mapping.ValueType.validate_value/1
, the function returns {:error, :unexpected_value_type}
instead of the correct :ok
.
This happens because the function body pattern-matches on the tuple {_subtype, bin}
rather than on a %Cyanide.Binary{}
struct, see here:
astarte_core/lib/astarte_core/mapping/value_type.ex
Lines 188 to 193 in 670a8c2
Cyanide.Binary{subtype: _subtype, data: binary}
struct should be used.matrix.include
deps
and _build
directoriesmix coveralls.travis
to script
instead of after_script
test
stage, consisting of 1 job:mix:test-coverage
: runs mix coveralls.details
mix format --check-formatted
to test-coverage
dialyzex
dep and configure it to use local directory for PLTs in ci
envmix:test-dialyzer
job to test
stage, runs mix dialyzer
in ci
env.mix format --check-formatted
so that it runs for external contributionsInterface name validation should allow names such as org.astarte-platform.InterfaceName
.
Right now, external Elixir applications are able to correctly validate Astarte Interfaces using the changesets contained in Astarte Core.
However, they are not able to do this with Triggers because the top Trigger changeset lives in Astarte Realm Management. This should be moved here so that it can be reused for, e.g., API clients installing triggers and so on.
It should return an error instead.
Minimal failing example:
Astarte.Core.Interface.changeset(%Astarte.Core.Interface{}, %{mappings: [%{"type" => "double"}]})
Currently, if a mapping contains
[...]
"database_retention_policy": "no_ttl",
"database_retention_ttl": 0,
[...]
the Interface validation fails since the TTL must be >= 60
, but with a no_ttl
policy the TTL isn't actually going to be used. We should decide how to handle this situation, either returning an error if a mapping uses no_ttl
and sets a TTL or by silently ignoring the TTL if no_ttl
is used (setting it to nil
in the changeset function).
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.