本文整理汇总了Golang中github.com/twinj/uuid.UUID类的典型用法代码示例。如果您正苦于以下问题:Golang UUID类的具体用法?Golang UUID怎么用?Golang UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UUID类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: newBatchArchive
// open an archive for writing batch recordings
func (r *Service) newBatchArchive(rid uuid.UUID) (*batchArchive, error) {
rpath := path.Join(r.saveDir, rid.String()+batchEXT)
f, err := os.Create(rpath)
if err != nil {
return nil, err
}
archive := zip.NewWriter(f)
return &batchArchive{f: f, archive: archive}, nil
}
开发者ID:karlitxo,项目名称:kapacitor,代码行数:10,代码来源:service.go
示例2: newStreamWriter
// create new stream writer
func (r *Service) newStreamWriter(rid uuid.UUID) (io.WriteCloser, error) {
rpath := path.Join(r.saveDir, rid.String()+streamEXT)
f, err := os.Create(rpath)
if err != nil {
return nil, fmt.Errorf("failed to save recording: %s", err)
}
gz := gzip.NewWriter(f)
sw := streamWriter{f: f, gz: gz}
return sw, nil
}
开发者ID:karlitxo,项目名称:kapacitor,代码行数:11,代码来源:service.go
示例3: doRecordStream
// Record the stream for a duration
func (r *Service) doRecordStream(rid uuid.UUID, dur time.Duration, dbrps []kapacitor.DBRP, started chan struct{}) error {
e, err := r.TaskMaster.NewFork(rid.String(), dbrps)
if err != nil {
return err
}
sw, err := r.newStreamWriter(rid)
if err != nil {
return err
}
defer sw.Close()
done := make(chan struct{})
go func() {
close(started)
start := time.Time{}
closed := false
for p, ok := e.NextPoint(); ok; p, ok = e.NextPoint() {
if closed {
continue
}
if start.IsZero() {
start = p.Time
}
if p.Time.Sub(start) > dur {
closed = true
close(done)
//continue to read any data already on the edge, but just drop it.
continue
}
kapacitor.WritePointForRecording(sw, p, precision)
}
}()
<-done
e.Abort()
r.TaskMaster.DelFork(rid.String())
return nil
}
开发者ID:karlitxo,项目名称:kapacitor,代码行数:38,代码来源:service.go
注:本文中的github.com/twinj/uuid.UUID类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论