FlatBuffers: Memory Efficient Serialization Library
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[Swift] Bump minimum supported version of swift to 5.10 (#8758) | 7 个月前 | |
Lock pnpm version to 10 in CI workflow (#9142) | 21 天前 | |
Remove invalid dependency on FLATBUFFERS_GENERATE_HEADERS_SCHEMAS (#8834) * Remove invalid dependency on FLATBUFFERS_GENERATE_HEADERS_SCHEMAS add_dependencies() is for targets. CMake 4.2.0 fails because of this (it shouldn't crash though, but that's another topic). See https://gitlab.kitware.com/cmake/cmake/-/issues/27415 * Use FLATC_TARGET --------- Co-authored-by: Justin Davis <jtdavis777@gmail.com> | 6 个月前 | |
FlatBuffers Version 25.12.19 (#8871) | 6 个月前 | |
[grpc] Support latest version of grpc PoC (#6338) * use grpcpp rather than deprecated grpc++ * grpcpp Deserialize take ByteBuffer instead of grpc_byte_buffer * grpc 1.36.0 * Fix to use grpc 1.36.0 * Fix CMakeLists to refer gRPC * add find_package(Threads) * Update bazel deps * Apply workaround about boringssl build error * Install latest cmake for osx on travis-ci Co-authored-by: Yeom Gyusun <omniavinco@gmail.com> | 5 年前 | |
swift 6.0+ performance tweaks 3x-6x (#9067) * start/stop measurements * tweaks * add 6.0 annotations * remove some inlines * address feedback * address wasi + let * adopt flex buffers * flex buffers benchmarks | 21 天前 | |
[Dart] Actually use resized FlexBuffers buffer (#8935) When building a FlexBuffer using the Builder and adding data that exceeds the default buffer size (2048 bytes), in _newOffset() a larger buffer is created, but never used. This results in a RangeError. Resolve by actually replacing the too small with the new larger buffer. Add a test that verifies this by adding multiple large strings to a vector. | 4 个月前 | |
Fix typo in generated header name (#9034) | 2 个月前 | |
bulk code format fix (#8707) | 9 个月前 | |
fix(go): add bounds checking to ByteVector (#8776) Add missing bounds checking to ByteVector before slice operations in the Go FlatBuffers implementation. Relative offset and vector length are now checked against the buffer size. Instead of panicking, the code now returns nil. Regression test added. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi> Co-authored-by: Justin Davis <jtdavis777@gmail.com> | 6 个月前 | |
Updates Rust codegen to use proper indentation (#8952) * Fixes identation of generated Rust code * Regenerates generated schemas | 4 个月前 | |
[Swift] Migrate to swift 6.0 and Implements support gRPC v2 (#8983) * Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming. | 2 个月前 | |
Fix logic inversion in FlexBuffers VerifyKey() (#9072) VerifyKey() returns true on the first non-zero byte instead of checking for a null terminator. This causes VerifyBuffer() to accept FlexBuffers with non-null-terminated keys. Subsequent access to those keys via strlen()/strcmp() reads out of bounds. The condition if (*p++) should be if (!*p++) — return true when a null terminator is found, not when any non-zero byte is found. Confirmed with AddressSanitizer: heap-buffer-overflow in strlen() after VerifyBuffer() returns true on a corrupted buffer. | 2 个月前 | |
FlatBuffers Version 25.12.19 (#8871) | 6 个月前 | |
docs: clean up whitespace and fix typo in tutorial.md (#8695) * docs: remove trailing whitespace * docs: fix typo in tutorial.md | 9 个月前 | |
Opt in to using experimental Kotlin Native APIs to suppress build warnings (#8885) - fixes #8846 | 4 个月前 | |
[Lobster] file_identifier support | 4 年前 | |
Feature: lua now file_ident aware (#8850) * lua code not file ident aware * update genned code * make mac happy * pr comments | 5 个月前 | |
docs: clean up whitespace and fix typo in tutorial.md (#8695) * docs: remove trailing whitespace * docs: fix typo in tutorial.md | 9 个月前 | |
Revert "fix using null string in vector (#7872)" (#8879) This reverts commit 1cb1c4baeeedfe3bc90d8c4110c889dd17af5ca7. | 4 个月前 | |
[Nim] Bfbs Nim Generator (#7534) * Bfbs Nim Generator * Remove commented out tests * add missing line to idl.h * Commit python reflection changes * Commit python reflection changes and move tests * Remove default string addition * Move tests to python file * Fix element size check when element is table * remove whitespace changes * add element_type docs and commit further to namer and remove kkeep * Bfbs Nim Generator * Remove commented out tests * add missing line to idl.h * Commit python reflection changes * Commit python reflection changes and move tests * Remove default string addition * Move tests to python file * Fix element size check when element is table * remove whitespace changes * add element_type docs and commit further to namer and remove kkeep * remove unused variables * added tests to ci * added tests to ci * fixes * Added reflection type Field, Variable to namer * Moved reflection namer impl to bfbsnamer * Remove whitespace at end of line * Added nim to generated code * Revert whitespace removal Co-authored-by: Derek Bailey <derekbailey@google.com> | 3 年前 | |
Fix PHP byte validation and reenable builds (#7670) * Fix PHP byte validation and reenable builds * Use checkout@v3 Co-authored-by: Derek Bailey <derekbailey@google.com> | 3 年前 | |
Stage the Python license file during builds (#9015) Copy the repo-root LICENSE into the Python package directory for the duration of setup() so license_files = LICENSE remains valid without using deprecated parent-directory paths. Remove the staged copy after the build completes. | 2 个月前 | |
Fix npm bzlmod (#8506) * Restrict visibility of exported file * Align npm_translate_lock attrs * Remove defs_bzl_filename attr * Align root_package with pnpm-lock.yaml location Use a symlink to avoid copying the file. | 1 年前 | |
fix: swapped argument order in new_inconsistent_union calls (#9001) (#9010) | 3 个月前 | |
[Swift] Migrate to swift 6.0 and Implements support gRPC v2 (#8983) * Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming. | 2 个月前 | |
[Swift] Migrate to swift 6.0 and Implements support gRPC v2 (#8983) * Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming. | 2 个月前 | |
use improved versioning (#6691) | 4 年前 | |
[Dart] Fix namespace alias from union type (#9088) * Fix namespace alias from union type * Fix namespace alias from union type | 1 个月前 | |
swift 6.0+ performance tweaks 3x-6x (#9067) * start/stop measurements * tweaks * add 6.0 annotations * remove some inlines * address feedback * address wasi + let * adopt flex buffers * flex buffers benchmarks | 21 天前 | |
[Swift] Fix verifier accepting truncated scalar vectors (OOB read/write, RCE) (#9081) | 2 个月前 | |
Add --ts-undefined-for-optionals command line option (#8861) * Add --ts-undefined-for-optionals command line option # Details - Fixes #7656 - Added a new `--ts-undefined-for-optionals` command line option for `flatc`. - If enabled, generated TypeScript code uses `undefined` for optional fields rather than `null`. * Also add TS generated test files * Run `sh scripts/clang-format-git.sh` * also add tests/ts/lalala-options.ts to the repo * move new tests to tests/ts/optional_values dir * add tests/ts/optional_values/optional_values_generated.cjs to the repo * reuse existing optional_scalars.fbs and add new test * add comma * sh scripts/clang-format-git.sh * remove comma * sh scripts/clang-format-git.sh * trying things * sh scripts/clang-format-git.sh * done * address feedback * sh scripts/clang-format-git.sh * run `sh scripts/clang-format-git.sh` * remove uneeded `eslint-disable @typescript-eslint/no-namespace` line --------- Co-authored-by: José Luis Millán <jmillan@aliax.net> | 5 个月前 | |
Test external modules explicitly in CI (#8507) This setup is much simpler than calling Bazel from within Bazel and making sure files and flags are set up correctly. Co-authored-by: Derek Bailey <derekbailey@google.com> | 1 年前 | |
Bump the versions of all aspect Bazel dependencies (#8508) * bump all aspect dependency versions to latest * add workspace file to test bazel repo | 1 年前 | |
Use the Google Style for clang-format without exceptions (#8706) This reduces the friction when merging from github and google repos by using the exact same clang style guide. MARKDOWN=true | 9 个月前 | |
Add clang-tidy, fix some bugpron problems. (#7708) * Add clang-tidy, fix some bugpron problems. * Fix more issues * Fix some more issues :)) * Minimal pr to just add clang-tidy Co-authored-by: Derek Bailey <derekbailey@google.com> | 3 年前 | |
Editorconfig: als configure to trim whitespaces end EOL. (#7833) Signed-off-by: Henner Zeller <hzeller@google.com> | 3 年前 | |
Unify line ending rules in '.editorconfig' and '.gitattributes' (#5231) * Unify line ending rules in '.editorconfig' and '.gitattributes' * Revert '.gitattributes' - fix invalid comments in the check-source.py | 7 年前 | |
Default Vector Support C++ (#8870) | 6 个月前 | |
Migrate from rules_nodejs to rules_js/rules_ts (take 2) (#7928) * Migrate from rules_nodejs to rules_js/rules_ts (take 2) This is the second version of patch #7923. The first version got reverted because bazel query was failing: $ bazel --nosystem_rc --nohome_rc query tests(set('//...')) except tests(attr("tags", "manual", set('//...'))) ERROR: Traceback (most recent call last): File "/workdir/tests/ts/bazel_repository_test_dir/BUILD", line 6, column 22, in <toplevel> npm_link_all_packages(name = "node_modules") File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/external/npm/defs.bzl", line 188, column 13, in npm_link_all_packages fail(msg) Error in fail: The npm_link_all_packages() macro loaded from @npm//:defs.bzl and called in bazel package 'tests/ts/bazel_repository_test_dir' may only be called in bazel packages that correspond to the pnpm root package '' and pnpm workspace projects '' This was happening because the `.bazelrc` file only added `--deleted_packages` to the `build` command. We also need it for the `query` command. This second version of the patch fixes that. Original commit message: This patch migrates the current use of rules_nodejs to the new rules_js. rules_js is the intended replacement of rules_nodejs as per this note: https://github.com/aspect-build/rules_js#relationship-to-rules_nodejs > rules_js is an alternative to the build_bazel_rules_nodejs Bazel module > and accompanying npm packages hosted in > https://github.com/bazelbuild/rules_nodejs, which is now > unmaintained. All users are recommended to use rules_js instead. There are a few notable changes in this patch: 1. The `flatbuffer_ts_library` macro no longer accepts a `package_name` attribute. This is because rules_js appears to manage the import naming of dependencies via top-level `npm_link_package` targets. Users will have to migrate. 2. I added a few more arguments to `flatbuffer_library_public()`. These helped with exposing esbuild to `ts/compile_flat_file.sh`. 3. I pinned the version of `typescript` in `package.json` so that rules_ts can download the exact same version. rules_ts doesn't know what to do if the version isn't exact. 4. Since rules_js uses the pnpm locking mechanism, we now have a `pnpm-lock.yaml` file instead of a yarn lock file. 4. I added bazel targets for a few of the existing tests in `tests/ts`. They can be run with `bazel test //test/ts:all`. Since there is no flexbuffers bazel target, I did not add a bazel target for the corresponding test. 5. I added a separate workspace in `tests/ts/bazel_repository_test_dir/` to validate that the flatbuffers code can be imported as an external repository. You can run the test with `bazel test //test/ts:bazel_repository_test`. For this to work, I needed to expose a non-trivial chunk of the flatbuffers code to the test. I achieved this through some recursive `distribution` filegroups. This is inspired by rules_python's workspace tests. I did not do anything special to validate that the `gen_reflections` parameter works the same. This patch doesn't change anything about the TypeScript generation. As a side note: I am not an expert with rules_js. This patch is my attempt based on my limited understanding of the rule set. Fixes #7817 * Fix the query --------- Co-authored-by: Derek Bailey <derekbailey@google.com> | 3 年前 | |
Remove Bazel WORKSPACE setup. (#8509) | 1 年前 | |
FlatBuffers Version 25.12.19 (#8871) | 6 个月前 | |
Fix missing namespace qualifier in Pack() (#8967) * Fix missing namespace qualifier in Pack() for cross-namespace table references * Fix missing namespace qualifier in Pack() * Add cross_namespace_pack_test to Bazel build | 3 个月前 | |
Fix docs: typo & dead link (#8826) * Fix CHANGELOG.md * Fix broken doc link | 6 个月前 | |
FlatBuffers Version 25.12.19 (#8871) | 6 个月前 | |
docs: clean up whitespace and fix typo in tutorial.md (#8695) * docs: remove trailing whitespace * docs: fix typo in tutorial.md | 9 个月前 | |
Rename LICENSE.txt to LICENSE (#7808) * Update PackageDebian.cmake * Rename LICENSE.txt to LICENSE * Update readme.md --------- Co-authored-by: Derek Bailey <derekbailey@google.com> | 3 年前 | |
build: Upgrade rules_swift to 3.1.2 and grpc to 1.76.0 (#8909) | 4 个月前 | |
[Swift] Migrate to swift 6.0 and Implements support gRPC v2 (#8983) * Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming. | 2 个月前 | |
docs: clean up whitespace and fix typo in tutorial.md (#8695) * docs: remove trailing whitespace * docs: fix typo in tutorial.md | 9 个月前 | |
Create Security.md Defining our security reporting process. | 5 年前 | |
Default Vector Support C++ (#8870) | 6 个月前 | |
(PHP) add experimental support for PHP language. * codegen for all basic features: WIP (probably implemented all basic feature) * JSON parsing: NO * Simple mutation: NO * Reflection: NO * Buffer verifier: NO (will be add later) * Testing: basic: Yes * Testing: fuzz: Yes * Performance: Not bad * Platform: Supported Linux, OS X, Windows (has 32bit integer limitation) * Engine Unity: No flatc --php monster_test.fbs <?php //include neccessary files. $fbb = new Google\FlatBuffers\FlatBufferBuilder(1); $str = $fbb->createString("monster"); \MyGame\Example\Monster::startMonster($fbb); \MyGame\Example\Monster::addHp($fbb, 80); \MyGame\Example\Monster::addName($fbb, $str); $mon = \MyGame\Example\Monster::endMonster($fbb); $fbb->finish($mon); echo $fbb->sizedByteArray(); PHP 5.4 higher Currently, we do not register this library to packagist as still experimental and versioning problem. If you intended to use flatbuffers with composer. add repostiories section to composer.json like below. "repositories": [{ "type": "vcs", "url": "https://github.com/google/flatbuffers" }], and just put google/flatbuffers. "require": { "google/flatbuffers": "*" } * PHP's integer is platform dependant. we strongly recommend use 64bit machine and don't use uint, ulong types as prevent overflow issue. ref: http://php.net/manual/en/language.types.integer.php * php don't support float type. floating point numbers are always parsed as double precision internally. ref: http://php.net/manual/en/language.types.float.php * ByteBuffer is little bit slow implemnentation due to many chr/ord function calls. Especially encoding objects. This is expected performance as PHP5 has parsing arguments overhead. probably we'll add C-extension. Basically, PHP implementation respects Java and C# implementation. Note: ByteBuffer and FlatBuffersBuilder class are not intended to use other purposes. we may change internal API foreseeable future. PSR-2, PSR-4 standards. Implemented simple assertion class (respect JavaScript testcase implementation) as we prefer small code base. this also keeps CI iteration speed. we'll choose phpunit or something when the test cases grown. | 10 年前 | |
[TS] Upgrade deps (#8620) | 1 年前 | |
Add support for Bzlmod (#8494) | 1 年前 | |
FlatBuffers Version 25.12.19 (#8871) | 6 个月前 | |
FlatBuffers Version 25.12.19 (#8871) | 6 个月前 | |
[TS] Fixup TS test run at CI (#9004) | 3 个月前 | |
[TS] Fixup TS test run at CI (#9004) | 3 个月前 | |
[Swift] Flexbuffers native swift port (#8577) * Offical Swift port for FlexBuffers This is the offical port for FlexBuffers within swift, and it introcudes a Common Module where code is shared between flatbuffers and flexbuffers. Writing most supported values like maps, vectors, nil and scalars into a flexbuffer buffer. And includes tests to verify that its similar to cpp * Reading a flexbuffer Implementing reading from a flexbuffer, enabling most of the buffers features, like most types, maps, vectors, typedvectors, and fixedtypedvectors. Currently, if an offset/object cant be read we default to a swift nil instead of the default flexbuffers 'null' with all values. * Fixes bazel breaking due to new project structure Address warnings within the library * Adds comment on why we added the code & properly enforce the amout of bytes needed | 1 年前 | |
Simplify and fix TypeScript compilation output (#7815) * Simplify and fix TypeScript compilation output * Revert deps upgrade | 3 年前 | |
[TS/JS] Upgrade dependencies (#7996) | 2 年前 | |
Fix reflection.fbs import path (#8499) We need to copy the .fbs files into the package used for .bfbs files. This is necessary as flatc doesn't provide support to specify the full output file name for an .fbs file in a different folder. I tried OUTPUT_FILE env var but this doesn't seem to be honored by flatc. | 1 年前 |
FlatBuffers 是一款跨平台序列化库,其架构旨在实现最高的内存效率。它允许您直接访问序列化数据,无需事先进行解析或解包,同时仍保持出色的向前/向后兼容性。
快速开始
-
构建 flatbuffers 编译器(
flatc)使用
cmake为您的平台创建构建文件,然后执行编译(以 Linux 为例)。cmake -G "Unix Makefiles" make -j -
定义您的 flatbuffer 模式(
.fbs)编写模式以定义您想要序列化的数据。有关示例,请参见 monster.fbs。
-
为您的语言生成代码
使用
flatc编译器处理您的模式,并生成特定于语言的代码:./flatc --cpp --rust monster.fbs这将生成
monster_generated.h和monster_generated.rs文件。 -
序列化数据
使用生成的代码以及
FlatBufferBuilder来构建您的序列化缓冲区。(C++示例) -
传输/存储/保存缓冲区
以您希望的任何方式使用序列化缓冲区。可以将其发送给他人、保存供以后使用等等。
-
读取数据
使用生成的访问器从序列化缓冲区中读取数据。
读取数据的语言或模式版本不必与写入时相同,FlatBuffers 确保数据可跨语言和模式版本读取。有关示例,请参见
Rust示例 读取由C++写入的数据。
文档
请前往我们的 landing page 浏览完整文档。
支持的操作系统
- Windows
- macOS
- Linux
- Android
- 以及其他任何配备最新 C++ 编译器(C++ 11 及更高版本)的操作系统
支持的编程语言
为多种流行语言提供代码生成工具和运行时库。
- C
- C++ - snapcraft.io
- C# - nuget.org
- Dart - pub.dev
- Go - go.dev
- Java - Maven
- JavaScript - NPM
- Kotlin
- Lobster
- Lua
- PHP
- Python - PyPI
- Rust - crates.io
- Swift - swiftpackageindex
- TypeScript - NPM
- Nim
版本控制
FlatBuffers 不遵循传统的 SemVer 语义化版本控制(详见 rationale),而是采用发布日期作为版本格式。
贡献
- 通过 FlatBuffers Issues Tracker 提交问题。
- 在 stackoverflow.com 使用
flatbufferstag 提问有关 FlatBuffers 的任何问题。
若要为此项目贡献代码,请参阅 CONTRIBUTING。
社区
安全
有关漏洞报告,请参阅我们的 安全政策。
许可
Flatbuffers 采用 Apache 许可证 2.0 版授权。完整许可证文本详见 LICENSE。
项目介绍
FlatBuffers:一种内存使用效率极高的序列化库。【此简介由AI生成】