File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ * All rights reserved.
4+ *
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree.
7+ */
8+
9+ #include " glean/client/swift/GlassAccessLocal.h"
10+ #include " c2p/secure_thrift/cpp/client/SecureThrift.h"
11+
12+ using namespace facebook ;
13+
14+ GlassAccessLocal::GlassAccessLocal () {
15+ std::string connectionTier = " glean.glass" ;
16+ client = facebook::corp2prod::client::getClientFactory ()
17+ .getClientUnique <apache::thrift::Client<::glean::GlassService>>(
18+ connectionTier);
19+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ * All rights reserved.
4+ *
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree.
7+ */
8+
9+ #pragma once
10+
11+ #include " glean/client/swift/GlassAccess.h"
12+
13+ class GlassAccessLocal : public GlassAccess {
14+ public:
15+ GlassAccessLocal ();
16+ ~GlassAccessLocal () override = default ;
17+ };
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ * All rights reserved.
4+ *
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree.
7+ */
8+
9+ #include < csignal>
10+ #include < memory>
11+ #include < utility>
12+ #include " folly/Singleton.h"
13+ #include " folly/init/Init.h"
14+ #include " glean/client/swift/GlassAccessLocal.h"
15+ #include " glean/client/swift/JsonServer.h"
16+
17+ // Folly singleton for JsonServer
18+ folly::Singleton<JsonServer> jsonServerSingleton ([]() {
19+ return new JsonServer ();
20+ });
21+
22+ void signalHandler (int signal) {
23+ if (signal == SIGINT ) {
24+ jsonServerSingleton.try_get ()->stop ();
25+ }
26+ }
27+
28+ int main (int argc, char ** argv) {
29+ folly::Init init (&argc, &argv);
30+
31+ std::signal (SIGINT , signalHandler);
32+
33+ // Create GlassAccessLocal and set it in JsonServer
34+ auto glassAccess = std::make_unique<GlassAccessLocal>();
35+ jsonServerSingleton.try_get ()->setGlassAccess (std::move (glassAccess));
36+
37+ // Start the server
38+ jsonServerSingleton.try_get ()->start ();
39+
40+ return 0 ;
41+ }
You can’t perform that action at this time.
0 commit comments