-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add fdv2 store & update sources to use fdv2 protocol definitio…
…ns (#192) This adds the FDv2 dual-mode store, which supports serving data requests from an in-memory store or from a persistent store (with cache).
- Loading branch information
1 parent
1c400a1
commit ece9cab
Showing
18 changed files
with
1,251 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package datasourcev2 | ||
|
||
import "github.com/launchdarkly/go-server-sdk/v7/internal/fdv2proto" | ||
|
||
// PollingResponse represents the result of a polling request. | ||
type PollingResponse struct { | ||
events []fdv2proto.Event | ||
cached bool | ||
intent fdv2proto.IntentCode | ||
selector *fdv2proto.Selector | ||
} | ||
|
||
// NewCachedPollingResponse indicates that the response has not changed. | ||
func NewCachedPollingResponse() *PollingResponse { | ||
return &PollingResponse{ | ||
cached: true, | ||
} | ||
} | ||
|
||
// NewPollingResponse indicates that data was received. | ||
func NewPollingResponse(intent fdv2proto.IntentCode, events []fdv2proto.Event, | ||
selector *fdv2proto.Selector) *PollingResponse { | ||
return &PollingResponse{ | ||
events: events, | ||
intent: intent, | ||
selector: selector, | ||
} | ||
} | ||
|
||
// Events returns the events in the response. | ||
func (p *PollingResponse) Events() []fdv2proto.Event { | ||
return p.events | ||
} | ||
|
||
// Cached returns true if the response was cached, meaning data has not changed. | ||
func (p *PollingResponse) Cached() bool { | ||
return p.cached | ||
} | ||
|
||
// Intent returns the server intent code of the response. | ||
func (p *PollingResponse) Intent() fdv2proto.IntentCode { | ||
return p.intent | ||
} | ||
|
||
// Selector returns the Selector of the response. | ||
func (p *PollingResponse) Selector() *fdv2proto.Selector { | ||
return p.selector | ||
} |
Oops, something went wrong.