Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to System.Format.CBor #49

Open
drasticactions opened this issue Apr 15, 2024 · 3 comments
Open

Switch to System.Format.CBor #49

drasticactions opened this issue Apr 15, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@drasticactions
Copy link
Owner

Peter.Cbor is an excellent library, but System.Format.Cbor is built into the runtime and would require one less dependency to run FishyFlip. The API is vastly different from Peter.Cbor, but it would probably be worth changing the code over to use the runtime version.

@drasticactions drasticactions added the enhancement New feature or request label Apr 15, 2024
@TimBurga
Copy link

TimBurga commented Sep 15, 2024

Curious if anyone has taken a stab at this yet. I tried putting together a POC and I cannot parse anything beyond t and op. I don't know if I'm using it wrong or if it doesn't handle the structure correctly or what.

Update: solved! When initializing a new CborReader pass true for allowMultipleRootLevelValues.

@TimBurga
Copy link

It looks like there's a significant delta between Peter's solution and what the native library offers.

The library only handles the most basic fundamentals like iterating a byte stream and reading out the value at that position. It doesn't provide any of the next-level features like parsing key/value pairs or maps or arrays.

Making this switch would involve reinventing all that logic. While I'm always in favor of reducing dependencies, I don't think dotnet is there yet.

@drasticactions
Copy link
Owner Author

FWIW I'm not against doing a simple implementation of that logic specifically for this. The CAR files are well defined, so needing to slice bytes and reading values out is not too hard. And it's not all or nothing: Replacing it would be an iterative process, so starting with one class and slowing going over until it's all gone.

But in general, yeah, right now we're in a good position with what we have. Peter.CBOR does throw a trimming error but I think it's in logging code if I recall correctly, for our needs it works great with NativeAOT. And while there have been some thrown issues with decoding CAR files from the library, it's more likely I'm screwing something up or not setting something than the library itself. It seems perfectly stable for this need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants