• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






张伯雨

学习使人快乐
 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 37 下一页

2017年9月1日

create_volume.go
摘要: package apiimport ( "net/http" "io/ioutil" "errors" "fmt")//创建存储空间func CreateVolume(host string, port int, vid uint64) error { url := fmt.Sprintf("http://%s:%d/%d/", host, port, vid) ... 阅读全文
posted @ 2017-09-01 09:17 张伯雨 阅读(148) 评论(0) 推荐(0)
 
upload.go
摘要: package apiimport ( "fmt" "os" "bytes" "mime/multipart" "path/filepath" "io" "net/http" "errors" "io/ioutil")func Upload(host string, port int, dst string, src string) (err ... 阅读全文
posted @ 2017-09-01 09:16 张伯雨 阅读(180) 评论(0) 推荐(0)
 
delete.go
摘要: package apiimport ( "fmt" "net/http" "io/ioutil" "errors")func Delete(host string, port int, filePath string) error { if filePath[0] == '/' { filePath = filePath[1:] } var ... 阅读全文
posted @ 2017-09-01 09:15 张伯雨 阅读(103) 评论(0) 推荐(0)
 
heartbeat.go
摘要: package apiimport ( "github.com/030io/whalefs/master" "fmt" "encoding/json" "bytes" "net/http" "io/ioutil")func Heartbeat(host string, port int, vms *master.VolumeManagerStatus) erro... 阅读全文
posted @ 2017-09-01 09:15 张伯雨 阅读(240) 评论(0) 推荐(0)
 
get.go
摘要: package apiimport ( "net/http" "fmt" "io/ioutil")func Get(host string, port int, filePath string) ([]byte, error) { if filePath[0] == '/' { filePath = filePath[1:] } var url s... 阅读全文
posted @ 2017-09-01 09:15 张伯雨 阅读(165) 评论(0) 推荐(0)
 
handler.go
摘要: package masterimport ( "net/http" "io/ioutil" "encoding/json" "time" "strings" "sync" "math/rand" "path/filepath" "fmt" "os" "github.com/030io/whalefs/utils/uuid")type... 阅读全文
posted @ 2017-09-01 09:13 张伯雨 阅读(249) 评论(0) 推荐(0)
 
uuid.go
摘要: package uuidimport "time"func GenerateUUID() uint64 { return uint64(time.Now().UnixNano()) //即从时间点January 1, 1970 UTC到时间点t所经过的时间(单位纳秒)} 阅读全文
posted @ 2017-09-01 09:12 张伯雨 阅读(211) 评论(0) 推荐(0)
 
disk.go
摘要: package diskimport "syscall"//空间使用结构体type DiskStatus struct { Size uint64 Used uint64 Free uint64}//空间使用情况func DiskUsage(path string) (disk *DiskStatus, err error) { fs := new(syscall.St... 阅读全文
posted @ 2017-09-01 09:11 张伯雨 阅读(257) 评论(0) 推荐(0)
 
kingpin_parser.go
摘要: package kingpin_parserimport ( "strconv" "gopkg.in/alecthomas/kingpin.v2" "fmt")type size uint64//单位换算func (s *size) Set(value string) error { num, err := strconv.ParseUint(value[:len(valu... 阅读全文
posted @ 2017-09-01 09:11 张伯雨 阅读(711) 评论(0) 推荐(0)
 
logrus_hook.go
摘要: package logrus_hookimport ( "runtime" "strings" "path/filepath" log "github.com/Sirupsen/logrus")type ContextHook struct {}func (hook ContextHook)Levels() []log.Level { return log.AllLe... 阅读全文
posted @ 2017-09-01 09:06 张伯雨 阅读(685) 评论(0) 推荐(0)
 
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 37 下一页