Skip to content

An io.Writer implementaion that can handle file rotation

License

Notifications You must be signed in to change notification settings

Psiphon-Inc/rotate-safe-writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Rotate Safe Writer

Makes an io.Writer that is resilient to inode changes (as caused by logrotate, file deletion, etc.)

This can be used anywhere that requires the io.Writer interface to be satisfied (including os.File). See the tests for usage examples

It works by storing the file's inode as it is opened, then checking whether or not the file at the original path still has the same inode value prior to calling File.Write(). If the inode has changed, the file at the original path will be re-opened, the new inode stored, then the write will continue as normal.

About

An io.Writer implementaion that can handle file rotation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages