flipt_client 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -1
- data/lib/ext/darwin_arm64/libfliptengine.dylib +0 -0
- data/lib/ext/darwin_x86_64/libfliptengine.dylib +0 -0
- data/lib/ext/linux_arm64/libfliptengine.so +0 -0
- data/lib/ext/linux_x86_64/libfliptengine.so +0 -0
- data/lib/ext/windows_x86_64/fliptengine.dll +0 -0
- data/lib/flipt_client/version.rb +1 -1
- data/lib/flipt_client.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20580ac221c34294feeb51f8a9198980d476fce87e8aafd50c9ac077df3ad498
|
4
|
+
data.tar.gz: f8342ae2127c00ca52b3f593bc094987050df738edf14567d4f5b988e22d4f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab287927c314e8c00a930ca7bfb92eed25788ee82d9d600e2eabb564abba98e33e4af3bc0fa5706ff4a12c8e398c732db1b50697799bccd28d14cbaf59e0fafb
|
7
|
+
data.tar.gz: cfd783d6e15b9fb5613f1c793d06d965330f574491fd2046a284fc579542cef57ffb49b157e6db7deaaf032eedaa1ae694d68682dba17752bd10834530aab1b6
|
data/README.md
CHANGED
@@ -10,6 +10,28 @@ The `flipt-client-ruby` library contains the Ruby source code for the Flipt [cli
|
|
10
10
|
gem install flipt_client
|
11
11
|
```
|
12
12
|
|
13
|
+
## How Does It Work?
|
14
|
+
|
15
|
+
The `flipt-client-ruby` library is a wrapper around the [flipt-engine-ffi](https://github.com/flipt-io/flipt-client-sdks/tree/main/flipt-engine-ffi) library.
|
16
|
+
|
17
|
+
All evaluation happens within the SDK, using the shared library built from the [flipt-engine-ffi](https://github.com/flipt-io/flipt-client-sdks/tree/main/flipt-engine-ffi) library.
|
18
|
+
|
19
|
+
Because the evaluation happens within the SDK, the SDKs can be used in environments where the Flipt server is not available or reachable after the initial data is fetched.
|
20
|
+
|
21
|
+
## Data Fetching
|
22
|
+
|
23
|
+
Upon instantiation, the `flipt-client-ruby` library will fetch the flag state from the Flipt server and store it in memory. This means that the first time you use the SDK, it will make a request to the Flipt server.
|
24
|
+
|
25
|
+
### Polling (Default)
|
26
|
+
|
27
|
+
By default, the SDK will poll the Flipt server for new flag state at a regular interval. This interval can be configured using the `update_interval` option when constructing a client. The default interval is 120 seconds.
|
28
|
+
|
29
|
+
### Streaming (Flipt Cloud Only)
|
30
|
+
|
31
|
+
[Flipt Cloud](https://flipt.io/cloud) users can use the `streaming` fetch method to stream flag state changes from the Flipt server to the SDK.
|
32
|
+
|
33
|
+
When in streaming mode, the SDK will connect to the Flipt server and open a persistent connection that will remain open until the client is closed. The SDK will then receive flag state changes in real-time.
|
34
|
+
|
13
35
|
## Supported Architectures
|
14
36
|
|
15
37
|
This SDK currently supports the following OSes/architectures:
|
@@ -61,11 +83,12 @@ puts resp
|
|
61
83
|
The `Flipt::EvaluationClient` constructor accepts two optional arguments:
|
62
84
|
|
63
85
|
- `namespace`: The namespace to fetch flag state from. If not provided, the client will default to the `default` namespace.
|
64
|
-
- `
|
86
|
+
- `opts`: A hash that supports several options for the client. The structure is:
|
65
87
|
- `url`: The URL of the upstream Flipt instance. If not provided, the client will default to `http://localhost:8080`.
|
66
88
|
- `update_interval`: The interval (in seconds) in which to fetch new flag state. If not provided, the client will default to 120 seconds.
|
67
89
|
- `authentication`: The authentication strategy to use when communicating with the upstream Flipt instance. If not provided, the client will default to no authentication. See the [Authentication](#authentication) section for more information.
|
68
90
|
- `reference`: The [reference](https://docs.flipt.io/guides/user/using-references) to use when fetching flag state. If not provided, reference will not be used.
|
91
|
+
- `fetch_mode`: The fetch mode to use when fetching flag state. If not provided, the client will default to polling.
|
69
92
|
|
70
93
|
### Authentication
|
71
94
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/flipt_client/version.rb
CHANGED
data/lib/flipt_client.rb
CHANGED
@@ -55,6 +55,8 @@ module Flipt
|
|
55
55
|
# @option opts [AuthenticationStrategy] :authentication strategy to authenticate with Flipt
|
56
56
|
# @option opts [Integer] :update_interval interval in seconds to update the cache
|
57
57
|
# @option opts [String] :reference reference to use for namespace data
|
58
|
+
# @option opts [Symbol] :fetch_mode fetch mode to use for the client (:polling or :streaming).
|
59
|
+
# Note: Streaming is currently only supported when using the SDK with Flipt Cloud (https://flipt.io/cloud).
|
58
60
|
def initialize(namespace = 'default', opts = {})
|
59
61
|
@namespace = namespace
|
60
62
|
|
@@ -65,6 +67,11 @@ module Flipt
|
|
65
67
|
'invalid authentication strategy'
|
66
68
|
end
|
67
69
|
|
70
|
+
fetch_mode = opts.fetch(:fetch_mode, :polling)
|
71
|
+
unless %i[polling streaming].include?(fetch_mode)
|
72
|
+
raise ArgumentError, 'invalid fetch mode'
|
73
|
+
end
|
74
|
+
|
68
75
|
opts[:authentication] = authentication.strategy
|
69
76
|
|
70
77
|
@engine = self.class.initialize_engine(namespace, opts.to_json)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipt_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flipt Devs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Flipt Client Evaluation SDK
|
14
14
|
email:
|