25 Commits

Author SHA1 Message Date
Markus Mäkelä
c7b9b7ac4a MXS-1220: Unify resource member naming
All resoures now use the `state` member to describe their internal
state. This includes servers, services and monitors. This means that the
`status` keyword can be reserved for something else and it can be removed
until it is needed again.

Changed the module maturity field to `maturity` to better describe its
purpose.
2017-07-10 22:23:45 +03:00
Markus Mäkelä
27d8212c51 Fix typo in server resource
The 'statistics' was mistakenly written as 'statictics'.
2017-06-27 21:45:00 +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
4e73aecdef MXS-1249: Modifications after rebase on develop 2017-06-21 13:28:59 +03:00
Johan Wikman
0d784da0ee MXS-1249: Prepare for storing version in server structure
The behaviour of the query classifier needs to be different
depending on the actual version of the server. There is already
a human readable string, but for programmatic use it needs to
be in a format that can easily be parsed.
2017-06-21 13:28:59 +03:00
Johan Wikman
3e39ec906e Change server version from char pointer to char array
With this change, it is no longer possible that the server version
is deallocated at the very moment it is read. There is still a race,
but it's mostly harmless.
2017-06-19 14:05:26 +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ä
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ä
a3ae9d5401 MXS-1220: Add missing JSON fields to servers
Added missing `monitoruser` and `monitorpw` parameters to the JSON output
of a server.
2017-05-04 09:17:54 +03:00
Markus Mäkelä
fdf279265a MXS-1220: Fix minor bugs
Destroyed servers were still shown as a part of the servers resource
collection.

If a parameter defined in persisted configurations was replaced, the value
would be appended to itself after it was replaced.

Return correct error codes for internal errors.

The server check was checking for old parameter locations.
2017-05-04 09:17:50 +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ä
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ä
043ed95bdf MXS-1220: Add PUT support for servers
The server can now be modified with a PUT request of a modified server
resource. The server resource was reorganized to have the parameters as a
separate entity from the other more general entities of the resource.

The PUT/POST functions return a more appropriate error message when no
request body is provided.

Moved some of the constant names used in server.cc into the config.h
header.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
695a4032ca Use common constants for monitor and server parameters
The parameter names for monitors and servers now use a set of constant
names. This removes some of the errors caused by spelling mistakes when
the same parameter name is repeated in multiple places.

The service, filter and listener parameters should also be converted to
constants. This allows for a consistent user experience.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
bc3cfe0221 MXS-1220: Fix memory leaks
Some of the JSON objects created in the diagnostic functions leaked
memory.
2017-05-04 09:14:03 +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ä
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ä
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ä
13cba2cb75 MXS-1220: Make server JSON functions const correct
The functions now take const parameters.

Also fixed a memory leak.
2017-05-04 09:11:18 +03:00
Markus Mäkelä
c4a8f8c8a6 MXS-1220: Add JSON functions for servers
The servers can now be printed in JSON format.
2017-05-04 09:11:17 +03:00
Markus Mäkelä
dd8a10f466 Remove old polling message system
The old polling message system is obsolete now that the worker messages
are implemented. The old system was only used to clean up the persistent
connection pool of a server.
2017-05-03 14:16:35 +03:00
Esa Korhonen
8f50269338 Add proxy protocol support
Adds a server-specific parameter, "use_proxy_protocol". If enabled,
a header string is sent to the backend when a routing session connection
changes state to MXS_AUTH_STATE_CONNECTED. The string contains the real
client IP and port.
2017-04-27 12:29:46 +03:00
Johan Wikman
bb1b7f9755 Compile server, service and session as C++ 2017-03-24 10:52:09 +02:00