- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for ringBuffer (0.21 sec)
-
internal/ringbuffer/README.md
# ringbuffer
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 2.1K bytes - Viewed (0) -
src/log/slog/internal/benchmarks/handlers.go
type asyncHandler struct { ringBuffer [100]slog.Record next int } func newAsyncHandler() *asyncHandler { return &asyncHandler{} } func (*asyncHandler) Enabled(context.Context, slog.Level) bool { return true } func (h *asyncHandler) Handle(_ context.Context, r slog.Record) error { h.ringBuffer[h.next] = r.Clone() h.next = (h.next + 1) % len(h.ringBuffer) return nil }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Apr 12 20:33:37 UTC 2023 - 4.1K bytes - Viewed (0) -
cmd/bitrot-streaming.go
package cmd import ( "bytes" "context" "hash" "io" "sync" xhttp "github.com/minio/minio/internal/http" "github.com/minio/minio/internal/ioutil" "github.com/minio/minio/internal/ringbuffer" ) // Calculates bitrot in chunks and writes the hash into the stream. type streamingBitrotWriter struct { iow io.WriteCloser closeWithErr func(err error) h hash.Hash shardSize int64
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 6.1K bytes - Viewed (0) -
src/log/slog/internal/benchmarks/handlers_test.go
t.Errorf("\ngot %q\nwant %q", got, wantText) } }) t.Run("async", func(t *testing.T) { h := newAsyncHandler() if err := h.Handle(ctx, r); err != nil { t.Fatal(err) } got := h.ringBuffer[0] if !got.Time.Equal(r.Time) || !slices.EqualFunc(attrSlice(got), attrSlice(r), slog.Attr.Equal) { t.Errorf("got %+v, want %+v", got, r) } }) } func attrSlice(r slog.Record) []slog.Attr {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Nov 17 23:34:11 UTC 2023 - 1.1K bytes - Viewed (0) -
internal/ringbuffer/ring_buffer_benchmark_test.go
package ringbuffer import ( "io" "strings" "testing" ) func BenchmarkRingBuffer_Sync(b *testing.B) { rb := New(1024) data := []byte(strings.Repeat("a", 512)) buf := make([]byte, 512) b.ResetTimer() for i := 0; i < b.N; i++ { rb.Write(data) rb.Read(buf) } } func BenchmarkRingBuffer_AsyncRead(b *testing.B) { // Pretty useless benchmark, but it's here for completeness. rb := New(1024)
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 1.7K bytes - Viewed (0)