Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[config-dev] Config playground - tree structure, parsing, polling/change watchers
  • From: Tomas Langer <tomas.langer@xxxxxxxxxx>
  • Date: Thu, 19 Aug 2021 14:28:29 +0000
  • Accept-language: cs-CZ, en-US
  • Arc-authentication-results: i=1; 1; spf=pass; dmarc=pass action=none; dkim=pass; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed;; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Nl9xfAp4Ld1B8ooUXtrMKGotRWynfm6xCPIvMlKrJys=; b=RTe5ty71fEiT6M4vUdzoGjemDQ7vJ9rXRI1dBmdX5dDhGBIRheALcboZn9UEQLKzup6bd/lJTBEk36ypPoEBsPWIUUhs/I+alGv3uODd+Cv6g28FaSI17Aha+bNkH1oYVm8A9RxSjiD7QPY221IHLRAxa79N8if6tXyNCIotDLxXTB7ihALNsGs5lETk/h1Mb3PbKKCiLsItCrDX3F4DWT7dZCoLqOqWOWQ7VqBOCbFWp0PJWvV+npu9vMOlri5MfIUGY26kKYD/GAtrr/4gRvK+5vWQuSa0qZ9s/D8D9A2oUCc412DxZL6cDDUBiskG+CO8Xt7GkcqvjlygZ0QZcw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901;; cv=none; b=WxyvRwr0fmf9jhYB7imErR4YyrG8eZ3BvhgI4TR9OO1MVvHIoWOe/IUL8iq6O+0/uNymFQ4ebPl3gRYk4A97bMms7mkepuMGrZszYjBgdlk/9A0nruP4+TRZv/NPD3ZxX5GzAiuA+mPNAy3eEEMF6wVX8b8kf3QAt4DpDs12w01ot+Ws2tdj13kjLNvsmliY2EVlhFEw3enuB1Ji6txIaxPimNXYuPyg/vpRa9/1SFTwtPT9m5bNrd60chPy5scVYB1v8XOIhpNLj+YzR1gLLl79bK0EMcAZhQBsHpI74AlkjJKv++TXSRiGtQ8URkjCdwpm4S9Jaj/Bgk3NFzA3sQ==
  • Delivered-to: config-dev@xxxxxxxxxxx
  • List-archive: <>
  • List-help: <>
  • List-subscribe: <>, <>
  • List-unsubscribe: <>, <>
  • Thread-index: AQHXlQZ671fOYrBYakirhava75aO6Q==
  • Thread-topic: Config playground - tree structure, parsing, polling/change watchers

As promised on the call, here is the link to the playground with SPI for config

This package contains the “full” features similar to what we do in Helidon

- ParsableConfigSource and ConfigParser - parsers support a specific content type and can convert a stream to tree)
- NodeConfigSource - tree node supported by source
- PollableConfigSource and PollingStrategy - config source is mutable and can be polled for changes
- WatchableConfigSource and ChangeWatcher - config source is mutable and changes can be found via an event from change watcher
- EventConfigSource - config source is mutable and it can trigger mutation events on its own

- ConfigNode - the tree node (can be Object, List or Value - similar to Object. Array and Value in JSON)

There are a few classes in “example” package that implement some of these interfaces.

This is a work in progress - I am trying to extract meaningful API from Helidon Config, so we can compare with MP and maybe decide to update some areas.

The main advantages I see compared to current MP:
- well defined mutability approach (using snapshots + capability to get latest version based on change events); the only loose end are “lazy” config sources, as these may provide a value whenever they choose to do so
- tree structure from config source up  - most config sources know the data in advance (files on class path, files, URL, in-memory etc.); this could also be used to have original types available (we actually create String from everything, but we may keep the original type at least when it is requested exactly)
- parsers - config source can read data from some storage; parser can parse data to tree structure. Separation of concerns allows for smaller code to implement a config source
- external mutability - config source can let the config do polling/change watching, and only focus on reading the data (again separation of concerns)


Back to the top