42 Commits

Author SHA1 Message Date
Johan Wikman
b1b78a5be7 Remove references to QUEUE_CONFIG
Only used in conjunction with queued connections, which are not
enabled anyway. Once that comes on the table again, better to use
some standard data structures.
2017-11-08 10:44:14 +02:00
Markus Mäkelä
582a65f77c Do not return empty relationships
If no relationships of a particular type are defined for a resource, the
key for that relationship should not be defined.
2017-10-23 19:37:24 +03:00
Markus Mäkelä
895d950da0 Format all source files with Astyle
Formatted all source files Astyle.
2017-09-28 07:04:21 +03:00
Johan Wikman
de7004cb95 Merge branch '2.1' into develop 2017-08-15 10:31:30 +03:00
Markus Mäkelä
c2a2688b93 Fix duplicate listener checks
Only the protocol, port and address of the listener were used to check if
a listener exists. The check should also use the name of the listener to
be sure that each name is unique.

Expanded tests to check that the creation of duplicate listeners is
detected. Did minor improvements to related test code.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
090de1a0f7 MXS-1220: Make individual listeners resources
The listeners are now a proper sub-resource of the service resource. This
means that it acts like a normal resource and can be queried both as a
collection of resources and as an individual resource.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
35745ee925 MXS-1220: Add deletion of listeners
The listeners can now be deleted via the REST API. Documented the added
endpoint in the REST API documentation.
2017-07-10 22:23:46 +03:00
Markus Mäkelä
61241f9e07 Remove old feedback system
The feedback system wasn't used and was starting to cause problems on
Debian 9 where the libcurl required different version of OpenSSL than what
MaxScale was linked against.
2017-07-10 16:03:50 +03:00
MassimilianoPinto
086e7abe77 CentOS 6 compile issues fixed
CentOS 6 compile issues fixed
2017-06-30 10:45:30 +02:00
Johan Wikman
33fe89772a MXS-1249: Return service version
Since it is now a single value, the service version can be returned
as a return value instead of via an out-argument. More convenient to
use that way.
2017-06-21 13:28:59 +03:00
Johan Wikman
997416ab82 MXS-1249: Server version stored as uint64_t value
That allows the version to be updated and read atomically. If
major/minor/patch are stored as separate variables, you can get an
inconsistent set. Now it may be out of date by the time it is used,
but it will never be internally inconsistent.
2017-06-21 13:28:59 +03:00
Johan Wikman
b8702b8d95 MXS-1249: Add function for getting the "version" of a service
The behaviour of the query classifier needs to change depending
on the version of the servers of a service. With this function
"some" version of the service can be obtained.
2017-06-21 13:28:59 +03:00
Johan Wikman
f546a17e77 Update change date of 2.2 2017-06-01 10:24:20 +03:00
Markus Mäkelä
157b7f853b MXS-1220: Fix resource self links
The top level resource self links pointed to the collection instead of the
resource itself. The individual resoures now also have a links field that
contains the self link to the resource. This should make navigation of the
API easier as all objects have valid links in them.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
613b924f2e Add listener iterator
The listener iterator hides the details of the listener iteration behind a
small set of functions.

The following for-loop demonstrates the main use-case for the iterator:

    LISTENER_ITERATOR iter;

    for (SERV_LISTENER *listener = listener_iterator_init(service, &iter);
         listener; listener = listener_iterator_next(&iter))
    {
        /** Do something with the listener */
    }

As the listeners are mostly iterated to either check a fact about them or
print their information, the functions cater to that use-case. For this
reason, they should always be allocated off the stack.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
717f883839 Make service ports lock-free
The service port list is now iterated in a safe and lock-free manner. This
makes the handling of service ports somewhat simpler since once an item
has been added to the list it will never be removed. It also removes the
need to lock the service when checking whether a service listens on a port
which caused potential deadlocks.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
08dca8c273 MXS-1220: Treat service listeners as service sub-resources
The listeners under the /services/:service/listeners collection are now
fully JSON API compliant resources.

The listeners could also be exposed as a /listeners collection to easily
group all listener type resources in one place. This approach does has
some semantical and practical problems, namely the fact that each listener
has a many-to-one relationship with its service and listeners by
themselves can't exist alone.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
fb7f283316 MXS-1220: Reorganize service resource
The service resource now conforms to the JSON API schema. Added a test
case for individual resources and resource collections.
2017-05-09 15:32:41 +03:00
Markus Mäkelä
ca62749f25 MXS-1220: Factor out common code from JSON object creation
The JSON objects that are created from the various core MaxScale objects
share a lot of common code. Moving this into a separate files removes the
redundant code.
2017-05-09 15:32:41 +03:00
Markus Mäkelä
49b45acd13 MXS-1220: Reorganize server resource
The server resource now conforms to the JSON API schema.
2017-05-09 15:32:41 +03:00
Markus Mäkelä
dcbd91deee Fix filters parameter processing
The filter names for the service parameter `filters` weren't converted
into the new format. This caused a configuration error when a filter with
significant whitespace in its name was used in a service.
2017-05-04 09:17:53 +03:00
Markus Mäkelä
fce0edce8e Allow NULL parameters for start/stop functions
The functions that start and stop monitors and services now accept NULL
parameters.
2017-05-04 09:17:52 +03:00
Markus Mäkelä
60526f15b8 MXS-1220: Add GET support for service listeners
The service listeners can now be queried as a separate resource. This is
the first step towards the creation and destruction of listeners.
2017-05-04 09:17:52 +03:00
Markus Mäkelä
f7fefad2e6 Improve persisted configuration handling
When a persisted configuration file is read, the values in it are
considered to be more up-to-date than the ones in the main configuration
file. This allows all objects to be persisted in a more complete form
making it easier to change configuration values at runtime.

This change is intended to help make runtime alterations to services
possible.
2017-05-04 09:17:49 +03:00
Markus Mäkelä
e62be5034a Use constant sized arrays for some service strings
The `user`, `password`, `version_string` and `weightby` values should be
allocated as a part of the service structure. This allows them to be
modified at runtime without having to worry about memory allocation
problems.

Although this removes the problem of reallocation, it still does not make
the updating of the strings thread-safe. This can cause invalid values to
be read from the service strings.
2017-05-04 09:17:48 +03:00
Markus Mäkelä
cd6e0ab5e9 MXS-1220: Show parameters for services, filters and monitors
The service, filter and monitor resources now have a "parameters" value
which contains a set of all configuration parameters for that object. This
set contains both standard and non-standard parameters.

Also fixed a mistake in the constant name definitions for the monitor
parameters "events" and "script".
2017-05-04 09:17:47 +03:00
Markus Mäkelä
722ca4c8d1 MXS-1220: Add service parameters to service resource
The service resource now exposes the parameters that were given to
it. This allows general service parameters to be changed at runtime
through the REST API.
2017-05-04 09:17:47 +03:00
Markus Mäkelä
dd68069471 MXS-1220: Add back the old diagnostic entry point
This makes 2.2 maxadmin backwards compatible with 2.1.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
84d085ef39 MXS-1220: Only list active server references
The services listed disabled server references in their relationships.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
50eafe19fe MXS-1220: Add self links to all resources
A self link to the resource itself provides a convenient way for the
client to request a resource, modify it and call the self link to update
it. This removes some of the burden on the client to keep track of the
resource links by placing these in the resource itself.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
3d2219e8ef MXS-1220: Add missing relationships
The relationships from servers to services and monitors and filters to
services were not implemented. Now each server lists the services and
monitors that use it and each filter lists the services that use the
filter.

This enables the creation of a server and linking of that server to
services and monitors in one atomic operation.
2017-05-04 09:14:03 +03:00
Markus Mäkelä
b6add43bd2 MXS-1220: Express relations in JSON API style
The JSON API (http://jsonapi.org/) specifies a way to express relations in
a somewhat generic way. By moving towards a more generic schema for the
resources, it will be easier to handle the modification of the relations
between these resources.
2017-05-04 09:14:03 +03:00
Markus Mäkelä
5b9c276123 MXS-1220: Create corrent relation links
When a resource has a relation to another resource, it should be expressed
as a working link to the resource. By passing the hostname of the server
to the functions, we are able to generate working relation links.
2017-05-04 09:14:01 +03:00
Markus Mäkelä
8c77e62872 MXS-1220: Make nested resources links
If a resource can be accessed from more than one place, it should be a
link. The previous change that duplicated the content for nested resources
wasn't a very clean solution. With links, the content is easier to browse
using a normal browser.
2017-05-04 09:12:16 +03:00
Markus Mäkelä
bbe0620944 MXS-1220: Add JSON return value to diagnostics entry points
The modules that implement a diagnostics entry point now return a JSON
type object. This removes the need to format data inside the modules.

The module implementations of these are not yet complete which means that
MaxScale will fail to compile.
2017-05-04 09:12:15 +03:00
Markus Mäkelä
94ebef0703 MXS-1220: Expand nested service and monitor resources
As a service is a collection of other resources, it makes sense to expand
those resources that were previously expressed as relative paths. This way
the API can be readily consumed without altering the pathnames to
links. The downside to this is the increased bandwidth consumption and
possible excess data.
2017-05-04 09:12:15 +03:00
Markus Mäkelä
aa16980cec MXS-1220: Fix date formatting
Some of the dates were printed with a trailing newline. This was added by
asctime_r.

Fixed `/services` resource returning an empty array.
2017-05-04 09:12:15 +03:00
Markus Mäkelä
d2e4d9cc64 MXS-1220: Make filter to JSON functions const correct
The functions don't modify the filters when the JSON is generated. This
means that the parameters can be const.

Minor formatting fixes to service sources.
2017-05-04 09:12:14 +03:00
Markus Mäkelä
b656f2b300 MXS-1220: Add JSON formatting for servers and filters
Both the filters and services can be queried via the REST API now that
these resources can be expressed in JSON format.

As with the other resources, these directly call the functions that
generate the data. This will be done via the inter-thread messaging system
once it's in place.
2017-05-04 09:12:14 +03:00
Johan Wikman
3b4fdbcf32 Fix compilation error 2017-04-18 14:53:12 +03:00
Markus Mäkelä
ad1c05b015 Merge branch '2.1' into develop 2017-04-05 11:35:13 +03:00
Johan Wikman
bb1b7f9755 Compile server, service and session as C++ 2017-03-24 10:52:09 +02:00