Comments (7)
This idea morphed from my initial, pretty boring idea of MultiWriter
. My thoughts were basically that most reusable io.Writer
implementations need to be (and in fact are) threadsafe. I didn't want to give newbie gophers the idea that things were inherently more dangerous than they are.
The ideal solution here would be to implement the following set of interfaces.
type ReadCounter interface {
io.Reader
// ReadCount returns the total number of bytes successfully read along
// with the total number of calls to Read().
ReadCount() (n int64, nops int)
}
type WriteCounter interface {
io.Writer
// WriteCount returns the total number of bytes successfully written along
// with the total number of calls to Write().
WriteCount() (n int64, nops int)
}
type ReadWriteCounter interface {
ReadCounter
WriteCounter
}
I've started on an example and tests. But would like to get some feedback before finishing.
from go.
Great idea!
But I'd find "paas-io" easier to parse as a name.
I guess it's a good idea to implement this in Go first and then write the generalized README (paas(-)io.md and paas(-)io.yml) for x-common.
If there's still room in the exercise one could calculate the cost for a given usage.
from go.
I noticed the name wasn't consistent with other exercises but left it "as is" to start the conversation. As a Go package "paasio" (or some variant) is the common practice. Underscores and and camelCase are not common in package names.
I was thinking about calculating costs as well. But when you look at pricing models for data transfer in PaaS systems you see a tiered model based on usage aggregated across all connections/files etc. So it's a little contrived to compute the cost of a single connection. Maybe an exercise in the future has you reading customer costs over a channel, aggregating them, and producing reports?
from go.
I noticed the name wasn't consistent with other exercises but left it "as is" to start the conversation. As a Go package "paasio" (or some variant) is the common practice. Underscores and and camelCase are not common in package names.
Right, packages/modules don't have to have the same name as the exercise.
from go.
Right, packages/modules don't have to have the same name as the exercise.
The directory the package is contained in has to have the same name as the exercise though. Right? That's what I'm getting at. A package named "paasio" in a directory named "paas-io" is not common either.
edit: typos
from go.
I think the name is fine. The existing names were chosen arbitrarily, and after a while I was sorry that I had chosen names with hyphens, but it seemed like it might be too late to change.
from go.
Closing this since the PR is merged.
from go.
Related Issues (20)
- Hamming exercise should depend on Error concept. HOT 1
- (Potentially) Implement New Concept Exercise: Compiling HOT 3
- Dead link in README HOT 1
- The Farm: Tests do not cover a condition of the exercise HOT 1
- Go track exercise elons-toys passes tests in cases where it should not
- Test error HOT 1
- Fails HOT 2
- Improve test output for the Clock exercise
- Enable test runner v3 UI for all concept exercises
- Ensure package names are unique
- Adding concurrency concepts to the syllabus HOT 3
- Community contributions are paused for this repo
- Outdated information in the 'Randomness' section HOT 1
- ErrStop and ErrInvalidBase not defined in the test file. HOT 1
- Booking up for Beauty: Better explanations for tasks HOT 1
- Update go version to 1.21 in go.mod across all or subset of problems? HOT 1
- Remove check for short test in benchmarks
- Hello world: Error: not in workspace HOT 1
- Building a training set of tags for go HOT 22
- Bug: instructions for kindergarten_garden do not match requirements HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go.