github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/server/debug/pprofui/storage.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package pprofui
    12  
    13  import "io"
    14  
    15  // Storage exposes the methods for storing and accessing profiles.
    16  type Storage interface {
    17  	// ID generates a unique ID for use in Store.
    18  	ID() string
    19  	// Store invokes the passed-in closure with a writer that stores its input.
    20  	Store(id string, write func(io.Writer) error) error
    21  	// Get invokes the passed-in closure with a reader for the data at the given id.
    22  	// An error is returned when no data is found.
    23  	Get(id string, read func(io.Reader) error) error
    24  }