Skip to content

Commit 53b0471

Browse files
committed
implement pipeline files in C++ side
1 parent 72ae07d commit 53b0471

14 files changed

+252
-0
lines changed

Firestore/core/src/api/firestore.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ void Firestore::SetClientLanguage(std::string language_token) {
227227
GrpcConnection::SetClientLanguage(std::move(language_token));
228228
}
229229

230+
PipelineSource Firestore::pipeline() {
231+
return {shared_from_this()};
232+
}
233+
230234
std::unique_ptr<ListenerRegistration> Firestore::AddSnapshotsInSyncListener(
231235
std::unique_ptr<core::EventListener<Empty>> listener) {
232236
EnsureClientConfigured();

Firestore/core/src/api/firestore.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "Firestore/core/src/model/database_id.h"
3030
#include "Firestore/core/src/util/byte_stream.h"
3131
#include "Firestore/core/src/util/status_fwd.h"
32+
#include "Firestore/core/swift/include/pipeline_source.h"
3233

3334
namespace firebase {
3435
namespace firestore {
@@ -125,6 +126,8 @@ class Firestore : public std::enable_shared_from_this<Firestore> {
125126
*/
126127
static void SetClientLanguage(std::string language_token);
127128

129+
PipelineSource pipeline();
130+
128131
private:
129132
void EnsureClientConfigured();
130133
core::DatabaseInfo MakeDatabaseInfo() const;

Firestore/core/swift/include/FirebaseFirestoreCpp.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#ifndef FIREBASE_FIREBASEFIRESTORECPP_H
1818
#define FIREBASE_FIREBASEFIRESTORECPP_H
1919

20+
#import "collection_stage.h"
21+
#import "firestore_pipeline.h"
22+
#import "pipeline.h"
23+
#import "pipeline_source.h"
24+
#import "stage.h"
2025
#import "used_by_swift.h"
2126

2227
#endif // FIREBASE_FIREBASEFIRESTORECPP_H
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Created by Cheryl Lin on 2024-12-11.
3+
//
4+
5+
#ifndef FIREBASE_COLLECTION_GROUP_STAGE_H
6+
#define FIREBASE_COLLECTION_GROUP_STAGE_H
7+
8+
#include <string>
9+
#include "stage.h"
10+
11+
namespace firebase {
12+
namespace firestore {
13+
14+
namespace api {
15+
16+
class Collection : public Stage {
17+
public:
18+
Collection(std::string collection_path);
19+
20+
private:
21+
std::string collection_path_;
22+
};
23+
24+
} // namespace api
25+
26+
} // namespace firestore
27+
} // namespace firebase
28+
29+
#endif // FIREBASE_COLLECTION_GROUP_STAGE_H
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Created by Cheryl Lin on 2024-12-10.
3+
//
4+
5+
#ifndef FIREBASE_FIRESTORE_PIPELINE_H
6+
#define FIREBASE_FIRESTORE_PIPELINE_H
7+
8+
#include "pipeline_source.h"
9+
10+
namespace firebase {
11+
namespace firestore {
12+
13+
namespace api {
14+
class Firestore;
15+
16+
class FirestorePipeline {
17+
public:
18+
PipelineSource pipeline(std::shared_ptr<Firestore> firestore);
19+
};
20+
21+
} // namespace api
22+
} // namespace firestore
23+
} // namespace firebase
24+
25+
#endif // FIREBASE_FIRESTORE_PIPELINE_H
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// Created by Cheryl Lin on 2024-12-11.
3+
//
4+
5+
#ifndef FIREBASE_PIPELINE_H
6+
#define FIREBASE_PIPELINE_H
7+
8+
#include <memory>
9+
#include "stage.h"
10+
11+
namespace firebase {
12+
namespace firestore {
13+
14+
namespace api {
15+
16+
class Firestore;
17+
18+
class Pipeline {
19+
public:
20+
Pipeline(std::shared_ptr<Firestore> firestore, Stage stage);
21+
22+
private:
23+
std::shared_ptr<Firestore> firestore_;
24+
Stage stage_;
25+
};
26+
27+
} // namespace api
28+
29+
} // namespace firestore
30+
} // namespace firebase
31+
32+
#endif // FIREBASE_PIPELINE_H
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// Created by Cheryl Lin on 2024-12-09.
3+
//
4+
5+
#ifndef FIREBASE_PIPELINE_SOURCE_H
6+
#define FIREBASE_PIPELINE_SOURCE_H
7+
8+
#include <memory>
9+
#include <vector>
10+
#include "pipeline.h"
11+
12+
namespace firebase {
13+
namespace firestore {
14+
15+
namespace api {
16+
17+
class Firestore;
18+
class DocumentReference;
19+
20+
class PipelineSource {
21+
public:
22+
PipelineSource(std::shared_ptr<Firestore> firestore);
23+
24+
Pipeline GetCollection(std::string collection_path);
25+
26+
private:
27+
std::shared_ptr<Firestore> firestore_;
28+
};
29+
30+
} // namespace api
31+
32+
} // namespace firestore
33+
} // namespace firebase
34+
35+
#endif // FIREBASE_PIPELINE_SOURCE_H

Firestore/core/swift/include/stage.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// Created by Cheryl Lin on 2024-12-11.
3+
//
4+
5+
#ifndef FIREBASE_STAGE_H
6+
#define FIREBASE_STAGE_H
7+
8+
namespace firebase {
9+
namespace firestore {
10+
11+
namespace api {
12+
13+
class Stage {
14+
public:
15+
Stage();
16+
};
17+
18+
} // namespace api
19+
20+
} // namespace firestore
21+
} // namespace firebase
22+
23+
#endif // FIREBASE_STAGE_H
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "Firestore/core/swift/include/collection_stage.h"
2+
#include <iostream>
3+
4+
namespace firebase {
5+
namespace firestore {
6+
7+
namespace api {
8+
9+
Collection::Collection(std::string collection_path)
10+
: collection_path_(collection_path) {
11+
std::cout << "Calling Pipeline Collection ctor" << std::endl;
12+
};
13+
14+
} // namespace api
15+
16+
} // namespace firestore
17+
} // namespace firebase
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "Firestore/core/swift/include/firestore_pipeline.h"
2+
#include "Firestore/core/src/api/firestore.h"
3+
4+
namespace firebase {
5+
namespace firestore {
6+
7+
namespace api {
8+
9+
PipelineSource FirestorePipeline::pipeline(
10+
std::shared_ptr<Firestore> firestore) {
11+
return firestore->pipeline();
12+
}
13+
14+
} // namespace api
15+
} // namespace firestore
16+
} // namespace firebase

0 commit comments

Comments
 (0)