Compare commits

..
Author SHA1 Message Date
John Colvin c80374579e fix build: Add a few includes, suppress some werrors
Not sure how this slipped through the cracks, but I'm guessing the build
broke when we upgraded the cpp compilers (to clang 17 and gcc 13).

* Include <cstdint> in a few places
* Suppress -Wstringop-overflow in sparkd-gcc-release build
* Change const char * param to explicit std::string for proper type
  deduction in call to 'std::make_tuple'. For some reason, the gcc build
  was failing with an array-bounds werror (changing the arg fixed it).
2024-03-18 19:14:48 +00:00
John Colvin 81cc0892f2 fix build: Remove version suffix from RuntimeIdentifiers in csprojs
They aren't required (nor supported) in dotnet 8
2024-03-18 15:13:01 -04:00
John Colvin 88714bb4b5 cleanup: Remove unnused token in BooleanExpression lex 2024-03-18 15:09:49 -04:00
John Colvin f39f1784a8 cleanup: Remove 'global.json' file
This config file is an artifact leftover from dotnet 6. I'm pretty sure
it's useless now.
2024-03-18 15:09:49 -04:00
John Colvin b7c8e72a07 feat: Add [incremental] MongoCollectionStream 2024-03-18 15:09:27 -04:00
John Colvin eea4af1f9b refactor: Impl IDictionary<int, IBlueRow> in BlueTable 2024-03-13 13:43:35 -05:00
John Colvin 6a244fee35 Normalize indentation in MongoDBStream 2024-03-13 13:43:35 -05:00
John Colvin d6a744e5ab Add echoDelay param to SimpleTCPServer 2024-03-13 13:43:35 -05:00
John Colvin 6f86b41f02 Add IObservable ViewStream wrapper 2024-03-13 13:43:35 -05:00
7 changed files with 9 additions and 38 deletions

No files matched your search

@@ -14,11 +14,8 @@ public class ObservableViewStream : ViewStream, IObservable<DataPacket>, IDispos
this.source = source;
public void Dispose() {
GC.SuppressFinalize(this);
if (subscription is not null) {
subscription.Dispose();
subscription = null;
}
subscription?.Dispose();
subscription = null;
}
protected override void myOnFirstSubscriber() {
@@ -188,7 +188,7 @@ public class MongoCollectionStream : ViewStream, IObservable<DataPacket> {
collection = database.GetCollection<BsonDocument>(collectionName);
var cursor = collection.Find(Builders<BsonDocument>.Filter.Empty).ToCursor();
var docList = await cursor.ToListAsync();
rowFactory ??= getRowFactory(docList);
rowFactory ??= MongoSchemaAdaptor.InferSchema(docList);
var firstTable = new BlueTableImmutable(rowFactory.Schema).ToDataPacketBuilder();
foreach (var doc in docList) {
var row = rowFactory.GetBlueRow(doc);
@@ -1,5 +1,7 @@
namespace Bts.DataStream;
using BCG;
using bts;
using MongoDB.Bson;
@@ -9,16 +9,16 @@ using System;
using System.Collections.Generic;
using System.Linq;
public class BlueTableSchemaAdaptor<T> : IMutableBlueRowFactory<T> {
public class BlueTableSchemaAdaptor<T> {
readonly string name;
readonly List<ColumnAdaptor> columns = new();
readonly List<ColumnAdaptor> columns = [];
BlueTableSchema? schema;
public BlueTableSchemaAdaptor(string name) =>
this.name = name;
public IBlueTableSchema Schema =>
schema ??= new BlueTableSchema(columns.WrapSelectorRO(c => c.Info).ToArray(), name);
schema ??= new BlueTableSchema([.. columns.WrapSelectorRO(c => c.Info)], name);
public bool Contains(string name) =>
columns.Any(c => c.Info.colName == name);
@@ -60,10 +60,7 @@ public class BlueTableSchemaAdaptor<T> : IMutableBlueRowFactory<T> {
columns.Add(new ColumnAdaptor(new(name, columns.Count, dataType), r => getValue(r)));
}
public IBlueRow GetBlueRow(T item) =>
GetMutableBlueRow(item);
public MutableBlueRow GetMutableBlueRow(T item) {
public IBlueRow GetBlueRow(T item) {
var mbr = new MutableBlueRow(Schema);
foreach (var col in columns) {
mbr.setValue(col.Info.colNo, col.GetValue(item));
@@ -1,9 +0,0 @@
#nullable enable
namespace Bts.DataStream;
using BCG;
public interface IBlueRowFactory<T> {
IBlueTableSchema Schema { get; }
IBlueRow GetBlueRow(T item);
}
@@ -1,11 +0,0 @@
#nullable enable
namespace Bts.DataStream;
using BCG;
public interface IMutableBlueRowFactory<T> : IBlueRowFactory<T> {
MutableBlueRow GetMutableBlueRow(T item);
IBlueRow IBlueRowFactory<T>.GetBlueRow(T item) =>
GetMutableBlueRow(item);
}
@@ -313,9 +313,4 @@ namespace BCG
return String.Format("DataPacket, schema {0} n {1} d {2} a {3}", schema.tableName, newRows.Count, deletedRows.Count, addedRows.Count);
}
}
public static class DataPacketExtensions {
public static bool HasChanges(this DataPacket dataPacket) =>
dataPacket.addedRows.Count > 0 || dataPacket.deletedRows.Count > 0;
}
}