Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Rebuf is a library that can be used as a WAL which can be used for logging and later replaying the data bytes during downstream service failure

License

NotificationsYou must be signed in to change notification settings

stym06/rebuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go

rebuf is a Golang implementation of WAL (Write Ahead||After Logging) which can also be used to log data bytes during a downstream service issue which can later be replayed on-demand

Features

  • Create and replay log data on any filesystem.
  • Lightweight and easy to use.
  • Efficient storage and retrieval of log data.

Installation

  1. Clone the repository:git clone https://github.com/stym06/rebuf.git
  2. Navigate to the project directory:cd rebuf
  3. Install the necessary dependencies by running:go mod download

Usage

func writeToStdout(data []byte) error {slog.Info(string(data))return nil}func main() {logger := slog.New(slog.NewTextHandler(os.Stdout, nil))//Init the RebufOptionsrebufOptions := &rebuf.RebufOptions{LogDir:      "/Users/satyamraj/personal/rebuf/data",FsyncTime:   5 * time.Second,MaxLogSize:  50,MaxSegments: 5,Logger:      logger,}//Init Rebufrebuf, err := rebuf.Init(rebufOptions)if err != nil {logger.Info("Error during Rebuf creation: " + err.Error())}defer rebuf.Close()// Write Bytesfor i := 0; i < 30; i++ {logger.Info("Writing data: ", "iter", i)go rebuf.Write([]byte("Hello world"))time.Sleep(300 * time.Millisecond)}//Replay and write to stdoutrebuf.Replay(writeToStdout)if err != nil {logger.Info(err.Error())}time.Sleep(30 * time.Second)}

License

This project is licensed under the MIT License. See theLICENSE file for more information.

Contact Information

If you have any questions or concerns, please feel free to reach out to the author on GitHub:@stym06.

About

Rebuf is a library that can be used as a WAL which can be used for logging and later replaying the data bytes during downstream service failure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp