This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 315227245958db77fd877c406bdcf8f3e4cf8a1c Author: chaokunyang <[email protected]> AuthorDate: Wed Feb 4 14:46:22 2026 +0000 🔄 synced local 'docs/guide/' with remote 'docs/guide/' --- docs/guide/cpp/schema-evolution.md | 12 ++++++++++++ docs/guide/go/schema-evolution.md | 14 ++++++++++++++ docs/guide/java/schema-evolution.md | 14 ++++++++++++++ docs/guide/python/schema-evolution.md | 21 +++++++++++++++++++++ docs/guide/rust/schema-evolution.md | 14 ++++++++++++++ 5 files changed, 75 insertions(+) diff --git a/docs/guide/cpp/schema-evolution.md b/docs/guide/cpp/schema-evolution.md index 89b57ff704..84cf354b95 100644 --- a/docs/guide/cpp/schema-evolution.md +++ b/docs/guide/cpp/schema-evolution.md @@ -76,6 +76,18 @@ int main() { } ``` +### Disable Evolution for Stable Structs + +If a struct schema is stable and will not change, you can disable evolution for that struct to avoid compatible metadata overhead. Use `FORY_STRUCT_EVOLVING` after `FORY_STRUCT`: + +```cpp +struct StableMessage { + int32_t id; +}; +FORY_STRUCT(StableMessage, id); +FORY_STRUCT_EVOLVING(StableMessage, false); +``` + ## Schema Evolution Features Compatible mode supports the following schema changes: diff --git a/docs/guide/go/schema-evolution.md b/docs/guide/go/schema-evolution.md index d84d4848cc..eea486e005 100644 --- a/docs/guide/go/schema-evolution.md +++ b/docs/guide/go/schema-evolution.md @@ -43,6 +43,20 @@ f := fory.New(fory.WithCompatible(true)) - Supports adding, removing, and reordering fields - Enables forward and backward compatibility +### Disable Evolution for Stable Structs + +If a struct schema is stable and will not change, you can disable evolution for that struct to avoid compatible metadata overhead. Implement the `ForyEvolving` interface and return `false`: + +```go +type StableMessage struct { + ID int64 +} + +func (StableMessage) ForyEvolving() bool { + return false +} +``` + ## Supported Schema Changes ### Adding Fields diff --git a/docs/guide/java/schema-evolution.md b/docs/guide/java/schema-evolution.md index c2be9b1692..c7db189658 100644 --- a/docs/guide/java/schema-evolution.md +++ b/docs/guide/java/schema-evolution.md @@ -46,6 +46,20 @@ System.out.println(fory.deserialize(bytes)); This compatible mode involves serializing class metadata into the serialized output. Despite Fory's use of sophisticated compression techniques to minimize overhead, there is still some additional space cost associated with class metadata. +### Disable Evolution for Stable Classes + +If a class schema is stable and will not change, you can opt out of schema evolution on a per-class basis to avoid compatible metadata overhead. Annotate the class with `@ForyObject(evolving = false)` to force `STRUCT/NAMED_STRUCT` type IDs even when Compatible mode is enabled. + +```java +import org.apache.fory.annotation.ForyObject; + +@ForyObject(evolving = false) +public class StableMessage { + public int id; + public String name; +} +``` + ## Meta Sharing To further reduce metadata costs, Fory introduces a class metadata sharing mechanism, which allows the metadata to be sent to the deserialization process only once. diff --git a/docs/guide/python/schema-evolution.md b/docs/guide/python/schema-evolution.md index 6990c392c9..bfd0a7482a 100644 --- a/docs/guide/python/schema-evolution.md +++ b/docs/guide/python/schema-evolution.md @@ -29,6 +29,27 @@ import pyfory f = pyfory.Fory(xlang=True, compatible=True) ``` +## Disable Evolution for Stable Classes + +If a dataclass schema is stable and will not change, you can disable evolution for that class to avoid compatible metadata overhead. Use `pyfory.dataclass` with `evolving=False`: + +```python +import pyfory + [email protected](evolving=False) +class StableMessage: + id: int + name: str +``` + +`pyfory.dataclass` also supports `slots=True`: + +```python [email protected](slots=True) +class SlotMessage: + id: int +``` + ## Schema Evolution Example ```python diff --git a/docs/guide/rust/schema-evolution.md b/docs/guide/rust/schema-evolution.md index 54f911461d..07d175eff5 100644 --- a/docs/guide/rust/schema-evolution.md +++ b/docs/guide/rust/schema-evolution.md @@ -69,6 +69,20 @@ assert_eq!(person_v2.age, 30); assert_eq!(person_v2.phone, None); ``` +### Disable Evolution for Stable Structs + +If a struct schema is stable and will not change, you can disable evolution for that struct to avoid compatible metadata overhead. Use `#[fory(evolving = false)]`: + +```rust +use fory::ForyObject; + +#[derive(ForyObject)] +#[fory(evolving = false)] +struct StableMessage { + id: i32, +} +``` + ## Schema Evolution Features - Add new fields with default values --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
