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

feat: 添加 MultipleBytes 实现多协程安全读写 #272

Merged
merged 10 commits into from
Jan 25, 2025

Conversation

justinwongcn
Copy link
Contributor

No description provided.

Copy link
Contributor

@flycash flycash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把线程安全的特征删掉,因为主要使用场景是单一 goroutine 内部。

而后使用装饰器模式额外提供一个线程安全的版本,你随便命名。

暴露一个 New 方法,参数是预期中的 slice 的数量,用于初始化你的 data 的容量。

iox/multiple_bytes.go Outdated Show resolved Hide resolved
iox/multiple_bytes.go Outdated Show resolved Hide resolved
iox/multiple_bytes.go Outdated Show resolved Hide resolved
iox/multiple_bytes_test.go Outdated Show resolved Hide resolved
@flycash flycash linked an issue Jan 21, 2025 that may be closed by this pull request
Copy link
Contributor

@flycash flycash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

并发测试不用那么麻烦,我们基本上通过代码 review 来确认加锁解锁没有问题。

而且这么复杂的测试,我看上去也没啥效果,所以可以删了。

或者说,并发版本你只要保证代码覆盖率就可以了

iox/multiple_bytes.go Outdated Show resolved Hide resolved
iox/multiple_bytes_test.go Show resolved Hide resolved
iox/concurrent_multiple_bytes_test.go Outdated Show resolved Hide resolved
iox/multiple_bytes_test.go Outdated Show resolved Hide resolved
@flycash flycash merged commit 10f8399 into ecodeclub:dev Jan 25, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iox: MultipleBytes
2 participants