@@ -43,7 +43,7 @@ See below for available libraries and descriptions.
4343
4444### Haystack
4545
46- This contains the
46+ This contains the
4747[ Haystack type-system primitives] ( https://project-haystack.org/doc/docHaystack/Kinds )
4848and utilities to interact with them.
4949
@@ -101,20 +101,55 @@ Once you create a client, you can use it to make requests:
101101``` swift
102102func yesterdaysValues () async throws -> Grid {
103103 let client = ...
104-
104+
105105 // Open and authenticate. This must be called before requests can be made
106106 try await client.open ()
107-
107+
108108 // Request the historical values for @28e7fb7d-e20316e0
109109 let grid = try await client.hisRead (id : Ref (" 28e7fb7d-e20316e0" ), range : .yesterday )
110-
110+
111111 // Close the client session and log out
112112 try await client.close ()
113-
113+
114114 return grid
115115}
116116```
117117
118+ ### HaystackServerVapor
119+
120+ A server for the [ Haystack HTTP API] ( https://project-haystack.org/doc/docHaystack/HttpApi ) that uses
121+ [ Vapor] ( https://github.com/vapor/vapor ) . It's separated from the ` HaystackServer ` package so that clients may use
122+ alternative server technologies if they choose, including Hummingbird or NIO directly.
123+
124+ It exposes a ` HaystackRouteCollection ` that can be registered on a Vapor
125+ application:
126+
127+ ``` swift
128+ let app = Application ()
129+ try app.register (collection : HaystackRouteCollection (delegate : ... ))
130+ ```
131+
132+ The delegate is a protocol that can be implemented however the user sees fit, although the standard Haystack
133+ implementation is defined in ` HaystackServer ` .
134+
135+ ### HaystackServer
136+
137+ This defines the standard functionality and data processing of Haystack API servers, based on generic backing data
138+ stores. In most cases, Haystack servers should use the ` HaystackServer ` class and customize storage behavior by
139+ implementing the ` RecordStore ` , ` HistoryStore ` , and ` WatchStore ` protocols.
140+
141+ ``` swift
142+ struct InfluxHistoryStore : HistoryStore {
143+ // Define storage behavior here
144+ ...
145+ }
146+
147+ let server = HaystackServer (
148+ historyStore : InfluxHistoryStore (),
149+ ...
150+ )
151+ ```
152+
118153## License
119154
120155This package is licensed under the Academic Free License 3.0 for maximum compatibility with
0 commit comments