Skip to content

Commit 421e857

Browse files
committed
clean up and link docs
1 parent 8e84bd1 commit 421e857

File tree

2 files changed

+20
-55
lines changed

2 files changed

+20
-55
lines changed

lib/ldclient-rb/impl/datasystem.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module DataSystem
2222
# This method will return immediately. The returned event will be set when the system
2323
# has reached an initial state (either permanently failed, e.g. due to bad auth, or succeeded).
2424
#
25+
# If called multiple times, returns the same event as the first call.
26+
#
2527
# @return [Concurrent::Event] Event that will be set when initialization is complete
2628
#
2729
def start
@@ -30,7 +32,7 @@ def start
3032

3133
#
3234
# Halts the data system. Should be called when the client is closed to stop any long running
33-
# operations.
35+
# operations. Makes the data system no longer usable.
3436
#
3537
# @return [void]
3638
#
@@ -80,7 +82,9 @@ def flag_change_broadcaster
8082
#
8183
# Indicates what form of data is currently available.
8284
#
83-
# @return [Symbol] One of DataAvailability constants
85+
# This is calculated dynamically based on current system state.
86+
#
87+
# @return [Symbol] one of the {DataAvailability} constants
8488
#
8589
def data_availability
8690
raise NotImplementedError, "#{self.class} must implement #data_availability"
@@ -89,7 +93,7 @@ def data_availability
8993
#
9094
# Indicates the ideal form of data attainable given the current configuration.
9195
#
92-
# @return [Symbol] One of DataAvailability constants
96+
# @return [Symbol] one of the {#DataAvailability} constants
9397
#
9498
def target_availability
9599
raise NotImplementedError, "#{self.class} must implement #target_availability"

lib/ldclient-rb/impl/datasystem/fdv1.rb

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module DataSystem
1212
# FDv1 wires the existing v1 data source and store behavior behind the
1313
# generic DataSystem surface.
1414
#
15+
# @see DataSystem
16+
#
1517
class FDv1
1618
include LaunchDarkly::Impl::DataSystem
1719

@@ -68,85 +70,48 @@ def initialize(sdk_key, config)
6870
@diagnostic_accumulator = nil
6971
end
7072

71-
#
72-
# Starts the v1 update processor and returns immediately. The returned event
73-
# will be set by the processor upon first successful initialization or upon permanent failure.
74-
#
75-
# If called multiple times, returns the same event as the first call. The update
76-
# processor is created only once, and subsequent calls delegate to the processor's
77-
# own start method which handles multiple invocations.
78-
#
79-
# @return [Concurrent::Event] Event that will be set when initialization is complete
80-
#
73+
# (see DataSystem#start)
8174
def start
8275
@update_processor ||= make_update_processor
8376
@update_processor.start
8477
end
8578

86-
#
87-
# Halts the data system, stopping the update processor and shutting down the executor,
88-
# making the data system no longer usable.
89-
#
90-
# @return [void]
91-
#
79+
# (see DataSystem#stop)
9280
def stop
9381
@update_processor&.stop
9482
@shared_executor.shutdown
9583
end
9684

97-
#
98-
# Returns the feature store wrapper used by this data system.
99-
#
100-
# @return [LaunchDarkly::Impl::DataStore::ClientWrapper]
101-
#
85+
# (see DataSystem#store)
10286
def store
10387
@store_wrapper
10488
end
10589

106-
#
107-
# Sets the diagnostic accumulator for streaming initialization metrics.
108-
# This should be called before start() to ensure metrics are collected.
109-
#
110-
# @param diagnostic_accumulator [DiagnosticAccumulator] The diagnostic accumulator
111-
# @return [void]
112-
#
90+
# (see DataSystem#set_diagnostic_accumulator)
11391
def set_diagnostic_accumulator(diagnostic_accumulator)
11492
@diagnostic_accumulator = diagnostic_accumulator
11593
end
11694

117-
#
118-
# Returns the data source status provider.
119-
#
120-
# @return [LaunchDarkly::Interfaces::DataSource::StatusProvider]
121-
#
95+
# (see DataSystem#data_source_status_provider)
12296
def data_source_status_provider
12397
@data_source_status_provider
12498
end
12599

126-
#
127-
# Returns the data store status provider.
128-
#
129-
# @return [LaunchDarkly::Interfaces::DataStore::StatusProvider]
130-
#
100+
# (see DataSystem#data_store_status_provider)
131101
def data_store_status_provider
132102
@data_store_status_provider
133103
end
134104

135-
#
136-
# Returns the broadcaster for flag change notifications.
137-
#
138-
# @return [LaunchDarkly::Impl::Broadcaster]
139-
#
105+
# (see DataSystem#flag_change_broadcaster)
140106
def flag_change_broadcaster
141107
@flag_change_broadcaster
142108
end
143109

144110
#
145-
# Indicates what form of data is currently available.
146-
#
147-
# This is calculated dynamically based on current system state.
111+
# (see DataSystem#data_availability)
148112
#
149-
# @return [Symbol] One of DataAvailability constants
113+
# In LDD mode, always returns CACHED for backwards compatibility,
114+
# even if the store is empty.
150115
#
151116
def data_availability
152117
return DataAvailability::DEFAULTS if @config.offline?
@@ -163,11 +128,7 @@ def data_availability
163128
DataAvailability::DEFAULTS
164129
end
165130

166-
#
167-
# Indicates the ideal form of data attainable given the current configuration.
168-
#
169-
# @return [Symbol] One of DataAvailability constants
170-
#
131+
# (see DataSystem#target_availability)
171132
def target_availability
172133
return DataAvailability::DEFAULTS if @config.offline?
173134
return DataAvailability::CACHED if @config.use_ldd?

0 commit comments

Comments
 (0)