a simple url shortening service, in the same vein as bit.ly and tinyurl.com, written in Go and using BoltDB as a backend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
519B

  1. package bbolt
  2. import (
  3. "syscall"
  4. "unsafe"
  5. )
  6. const (
  7. msAsync = 1 << iota // perform asynchronous writes
  8. msSync // perform synchronous writes
  9. msInvalidate // invalidate cached data
  10. )
  11. func msync(db *DB) error {
  12. _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate)
  13. if errno != 0 {
  14. return errno
  15. }
  16. return nil
  17. }
  18. func fdatasync(db *DB) error {
  19. if db.data != nil {
  20. return msync(db)
  21. }
  22. return db.file.Sync()
  23. }