本文整理汇总了Golang中go/pedge/io/protolog.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: run
func (n *nodeRunner) run() error {
var err error
for name, parentChan := range n.parentChans {
protolog.Debug(&NodeWaiting{Node: n.nodeName, ParentNode: name})
select {
case parentErr := <-parentChan:
if parentErr != nil {
err = parentErr
}
continue
case <-n.cancel:
return err
}
}
protolog.Debug(&NodeFinishedWaiting{Node: n.nodeName, ParentError: errorString(err)})
if err == nil {
protolog.Info(&NodeStarting{Node: n.nodeName})
err = n.f()
protolog.Info(&NodeFinished{Node: n.nodeName, Error: errorString(err)})
}
for name, childChan := range n.childrenChans {
protolog.Debug(&NodeSending{Node: n.nodeName, ChildNode: name, Error: errorString(err)})
childChan <- err
close(childChan)
}
return err
}
开发者ID:henrylee2cn,项目名称:pachyderm,代码行数:27,代码来源:node_runner.go
示例2: LogMethodInvocation
func (l *logger) LogMethodInvocation(methodInvocation *MethodInvocation) {
if methodInvocation.Error != "" {
protolog.Error(methodInvocation)
} else {
protolog.Info(methodInvocation)
}
}
开发者ID:kunthar,项目名称:pachyderm,代码行数:7,代码来源:logger.go
示例3: execTransID
func execTransID(path string) (result string, retErr error) {
defer func() {
protolog.Info(&TransID{path, result, errorToString(retErr)})
}()
// "9223372036854775810" == 2 ** 63 we use a very big number there so that
// we get the transid of the from path. According to the internet this is
// the nicest way to get it from btrfs.
var buffer bytes.Buffer
if err := executil.RunStdout(&buffer, "btrfs", "subvolume", "find-new", path, "9223372036854775808"); err != nil {
return "", err
}
scanner := bufio.NewScanner(&buffer)
for scanner.Scan() {
// scanner.Text() looks like this:
// transid marker was 907
// 0 1 2 3
tokens := strings.Split(scanner.Text(), " ")
if len(tokens) != 4 {
return "", fmt.Errorf("pachyderm: failed to parse find-new output")
}
return tokens[3], nil
}
if scanner.Err() != nil {
return "", scanner.Err()
}
return "", fmt.Errorf("pachyderm: empty output from find-new")
}
开发者ID:sr,项目名称:pachyderm,代码行数:27,代码来源:driver.go
示例4: Open
func (f *file) Open(ctx context.Context, request *fuse.OpenRequest, response *fuse.OpenResponse) (_ fs.Handle, retErr error) {
defer func() {
protolog.Info(&FileRead{&f.Node, errorToString(retErr)})
}()
atomic.AddInt32(&f.handles, 1)
return f, nil
}
开发者ID:klucar,项目名称:pachyderm,代码行数:7,代码来源:filesystem.go
示例5: announceState
func (a *discoveryAddresser) announceState(
id string,
address string,
server Server,
versionChan chan int64,
cancel chan bool,
) error {
serverState := &proto.ServerState{
Id: id,
Address: address,
Version: InvalidVersion,
}
for {
shards, err := server.LocalShards()
if err != nil {
return err
}
serverState.Shards = shards
encodedServerState, err := marshaler.MarshalToString(serverState)
if err != nil {
return err
}
if err := a.discoveryClient.Set(a.serverStateKey(id), encodedServerState, holdTTL); err != nil {
return err
}
protolog.Info(&log.SetServerState{serverState})
select {
case <-cancel:
return nil
case version := <-versionChan:
serverState.Version = version
case <-time.After(time.Second * time.Duration(holdTTL/2)):
}
}
}
开发者ID:sr,项目名称:pachyderm,代码行数:35,代码来源:discovery_addresser.go
示例6: execSend
func execSend(path string, parent string, diff io.Writer) (retErr error) {
defer func() {
protolog.Info(&Send{path, parent, errorToString(retErr)})
}()
if parent == "" {
return executil.RunStdout(diff, "btrfs", "send", path)
}
return executil.RunStdout(diff, "btrfs", "send", "-p", parent, path)
}
开发者ID:sr,项目名称:pachyderm,代码行数:9,代码来源:driver.go
示例7: execSubvolumeExists
func execSubvolumeExists(path string) (result bool) {
defer func() {
protolog.Info(&SubvolumeExists{path, result})
}()
if err := executil.Run("btrfs", "subvolume", "show", path); err != nil {
return false
}
return true
}
开发者ID:sr,项目名称:pachyderm,代码行数:9,代码来源:driver.go
示例8: execSubvolumeSnapshot
func execSubvolumeSnapshot(src string, dest string, readOnly bool) (retErr error) {
defer func() {
protolog.Info(&SubvolumeSnapshot{src, dest, readOnly, errorToString(retErr)})
}()
if readOnly {
return pkgexec.Run("btrfs", "subvolume", "snapshot", "-r", src, dest)
}
return pkgexec.Run("btrfs", "subvolume", "snapshot", src, dest)
}
开发者ID:mehulsbhatt,项目名称:pachyderm,代码行数:9,代码来源:driver.go
示例9: Register
func (a *discoveryAddresser) Register(cancel chan bool, id string, address string, server Server) (retErr error) {
protolog.Info(&log.StartRegister{id, address})
defer func() {
protolog.Info(&log.FinishRegister{id, address, errorToString(retErr)})
}()
var once sync.Once
versionChan := make(chan int64)
internalCancel := make(chan bool)
var wg sync.WaitGroup
wg.Add(3)
go func() {
defer wg.Done()
if err := a.announceState(id, address, server, versionChan, internalCancel); err != nil {
once.Do(func() {
retErr = err
close(internalCancel)
})
}
}()
go func() {
defer wg.Done()
if err := a.fillRoles(id, server, versionChan, internalCancel); err != nil {
once.Do(func() {
retErr = err
close(internalCancel)
})
}
}()
go func() {
defer wg.Done()
select {
case <-cancel:
once.Do(func() {
retErr = ErrCancelled
close(internalCancel)
})
case <-internalCancel:
}
}()
wg.Wait()
return
}
开发者ID:bereal,项目名称:pachyderm,代码行数:42,代码来源:discovery_addresser.go
示例10: Attr
func (d *directory) Attr(ctx context.Context, a *fuse.Attr) (retErr error) {
defer func() {
protolog.Info(&DirectoryAttr{&d.Node, &Attr{uint32(a.Mode)}, errorToString(retErr)})
}()
if d.Write {
a.Mode = os.ModeDir | 0775
} else {
a.Mode = os.ModeDir | 0555
}
return nil
}
开发者ID:alexdebrie,项目名称:pachyderm,代码行数:11,代码来源:filesystem.go
示例11: Read
func (f *file) Read(ctx context.Context, request *fuse.ReadRequest, response *fuse.ReadResponse) (retErr error) {
defer func() {
protolog.Info(&FileRead{&f.Node, errorToString(retErr)})
}()
buffer := bytes.NewBuffer(make([]byte, 0, request.Size))
if err := pfsutil.GetFile(f.fs.apiClient, f.RepoName, f.CommitID, f.Path, request.Offset, int64(request.Size), buffer); err != nil {
return err
}
response.Data = buffer.Bytes()
return nil
}
开发者ID:alexdebrie,项目名称:pachyderm,代码行数:11,代码来源:filesystem.go
示例12: Lookup
func (d *directory) Lookup(ctx context.Context, name string) (result fs.Node, retErr error) {
defer func() {
protolog.Info(&DirectoryLookup{&d.Node, name, getNode(result), errorToString(retErr)})
}()
if d.File.Commit.Repo.Name == "" {
return d.lookUpRepo(ctx, name)
}
if d.File.Commit.Id == "" {
return d.lookUpCommit(ctx, name)
}
return d.lookUpFile(ctx, name)
}
开发者ID:klucar,项目名称:pachyderm,代码行数:12,代码来源:filesystem.go
示例13: execSubvolumeFindNew
func execSubvolumeFindNew(commit string, fromCommit string, out io.Writer) (retErr error) {
defer func() {
protolog.Info(&SubvolumeFindNew{commit, fromCommit, errorToString(retErr)})
}()
if fromCommit == "" {
return executil.RunStdout(out, "btrfs", "subvolume", "find-new", commit, "0")
}
transid, err := execTransID(fromCommit)
if err != nil {
return err
}
return executil.RunStdout(out, "btrfs", "subvolume", "find-new", commit, transid)
}
开发者ID:sr,项目名称:pachyderm,代码行数:13,代码来源:driver.go
示例14: Mkdir
func (d *directory) Mkdir(ctx context.Context, request *fuse.MkdirRequest) (result fs.Node, retErr error) {
defer func() {
protolog.Info(&DirectoryMkdir{&d.Node, getNode(result), errorToString(retErr)})
}()
if d.File.Commit.Id == "" {
return nil, fuse.EPERM
}
if err := pfsutil.MakeDirectory(d.fs.apiClient, d.File.Commit.Repo.Name, d.File.Commit.Id, path.Join(d.File.Path, request.Name)); err != nil {
return nil, err
}
localResult := d.copy()
localResult.File.Path = path.Join(localResult.File.Path, request.Name)
return localResult, nil
}
开发者ID:klucar,项目名称:pachyderm,代码行数:14,代码来源:filesystem.go
示例15: Root
func (f *filesystem) Root() (result fs.Node, retErr error) {
defer func() {
protolog.Info(&Root{&f.Filesystem, getNode(result), errorToString(retErr)})
}()
return &directory{
f,
Node{&pfs.File{
Commit: &pfs.Commit{
Repo: &pfs.Repo{},
},
},
true},
}, nil
}
开发者ID:klucar,项目名称:pachyderm,代码行数:14,代码来源:filesystem.go
示例16: GetShardToMasterAddress
func (a *discoveryAddresser) GetShardToMasterAddress(version int64) (result map[uint64]string, retErr error) {
defer func() {
protolog.Info(&log.GetShardToMasterAddress{version, result, errorToString(retErr)})
}()
addresses, err := a.getAddresses(version)
if err != nil {
return nil, err
}
_result := make(map[uint64]string)
for shard, shardAddresses := range addresses.Addresses {
_result[shard] = shardAddresses.Master
}
return _result, nil
}
开发者ID:sr,项目名称:pachyderm,代码行数:14,代码来源:discovery_addresser.go
示例17: GetReplicaAddresses
func (a *discoveryAddresser) GetReplicaAddresses(shard uint64, version int64) (result map[string]bool, retErr error) {
defer func() {
protolog.Info(&log.GetReplicaAddresses{shard, version, result, errorToString(retErr)})
}()
addresses, err := a.getAddresses(version)
if err != nil {
return nil, err
}
shardAddresses, ok := addresses.Addresses[shard]
if !ok {
return nil, fmt.Errorf("shard %d not found", shard)
}
return shardAddresses.Replicas, nil
}
开发者ID:sr,项目名称:pachyderm,代码行数:14,代码来源:discovery_addresser.go
示例18: GetMasterAddress
func (a *discoveryAddresser) GetMasterAddress(shard uint64, version int64) (result string, ok bool, retErr error) {
defer func() {
protolog.Info(&log.GetMasterAddress{shard, version, result, ok, errorToString(retErr)})
}()
addresses, err := a.getAddresses(version)
if err != nil {
return "", false, err
}
shardAddresses, ok := addresses.Addresses[shard]
if !ok {
return "", false, nil
}
return shardAddresses.Master, true, nil
}
开发者ID:sr,项目名称:pachyderm,代码行数:14,代码来源:discovery_addresser.go
示例19: Write
func (f *file) Write(ctx context.Context, request *fuse.WriteRequest, response *fuse.WriteResponse) (retErr error) {
defer func() {
protolog.Info(&FileWrite{&f.Node, errorToString(retErr)})
}()
written, err := pfsutil.PutFile(f.fs.apiClient, f.File.Commit.Repo.Name, f.File.Commit.Id, f.File.Path, request.Offset, bytes.NewReader(request.Data))
if err != nil {
return err
}
response.Size = written
if f.size < request.Offset+int64(written) {
f.size = request.Offset + int64(written)
}
return nil
}
开发者ID:klucar,项目名称:pachyderm,代码行数:14,代码来源:filesystem.go
示例20: CreatePipelineRun
func (a *apiServer) CreatePipelineRun(ctx context.Context, request *pps.CreatePipelineRunRequest) (*pps.PipelineRun, error) {
pipelineRun := &pps.PipelineRun{
Id: strings.Replace(uuid.NewV4().String(), "-", "", -1),
PipelineId: request.PipelineId,
}
if err := a.storeClient.CreatePipelineRun(pipelineRun); err != nil {
return nil, err
}
protolog.Info(
&CreatedPipelineRun{
PipelineRun: pipelineRun,
},
)
return pipelineRun, nil
}
开发者ID:sr,项目名称:pachyderm,代码行数:15,代码来源:api_server.go
注:本文中的go/pedge/io/protolog.Info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论