apache / apache/incubator-seata

optimize compressUtil

Open
#4,071 3 comments 0 reactions 1 assignee Assigned to @YongGoose View on GitHub
task: help-wanted type: optimize
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

## Why you need it?
Is your feature request related to a problem? Please describe in details
1. io.seata.common.util.CompressUtil 和 io.seata.compressor.gzip.GzipCompressor 重合了,CompressUtil可以直接去掉
2. CompressUtil比GzipCompressor多了个isCompressData的方法,有两种方案,a. 为Compressor的每个实现都添加isCompress的方法,然后直接把使用了isCompressData的地方迁移过去;b. 把用到了isCompressData的地方优化掉,可以把根据isCompressData判断数据是否被加密,改成加一个字节直接保存数据是否已加密会更好。

针对第2点的还有个问题,当前的支持的Compressor的对于是否被加密了,都是只能通过判断前2-4位的magic number来判断,不排除有一定的误判的可能性,虽然在当前的使用场景中不会出现问题,但是在客观上依然属于一个小问题,个人建议采用b方案。

如果有兴趣优化的,可以在下方留言`please assign it to me`

## How it could be?
A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.

## Other related information
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.