apache / incubator-fury

A blazingly fast multi-language serialization framework powered by JIT and zero-copy.

Home Page:https://fury.apache.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Java] Support userContext for user custom global data

MrChang0 opened this issue · comments

Is your feature request related to a problem? Please describe.

when I want compress some Map<String, String> map, it have lots of same string key, I want make user serializer contain a map key dict suche as Map<String, Integer> dict and I can just serializer key as int, then write dict data after metaContext.
but fury cant costum metaContext to save user global data.

btw, stringRefIgnored open will take slow serilizer time.

Describe the solution you'd like

maybe we can support user context with open interface like interface userContext with method wirteData(MemoryBuffer buffer) and write(MemoryBuffer buffer) and constructr(Fury fury). we can take it just like fury.registerUserContext("name", CompressStringDictMapContext.class). we can take userContext like fury.getUserContext("name")
when after wirte metaContext, wirte all register userContext data by register order, same to read.

Additional context

I make a simple compress map version in my local project, so I think a userContext can take better flexibility

thanks

Hi, Fury has a SerializationContext class. Could we use this class to implement this feature?

sure, I will take a simple code for this feature.