{"modulePath":"github.com/chainloop-dev/chainloop","version":"v1.138.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pointer\n\nPackage pointer holds the parts of the pointers to spec sources that do not depend on the agent (spec issue-3556).\n\nA spec source is a file of the spec folder that the push stores as its own material. A session transcript can hold the same content again, for example in a full read of the file or in the write that created it. Each agent that can find these copies replaces each one, at its position, with a pointer that holds the digest of the material. Only exact copies are replaced: the digest of the content must be equal to the digest of a source.\n\n## Constants\n\n```go\nconst (\n\tFinderFileRead  = \"file_read\"\n\tFinderFileWrite = \"file_write\"\n\t// FinderPastedImage finds the images that the user pasted into the\n\t// session (spec issue-3569).\n\tFinderPastedImage = \"pasted_image\"\n)\n```\nThe finders, as the match report names them.\n\n```go\nconst (\n\tReasonNoSpecEntry = \"no spec entry with this digest\"\n\tReasonFileGone    = \"file gone\"\n\tReasonFileChanged = \"file changed\"\n\tReasonPartialRead = \"partial read\"\n\tReasonToolError   = \"tool error\"\n\tReasonUnsupported = \"unsupported result\"\n\t// ReasonInvalidImage is a pasted image whose data cannot be decoded.\n\tReasonInvalidImage = \"invalid image data\"\n\t// ReasonMaterialNotStored is a pasted image that the push could not\n\t// store as a material.\n\tReasonMaterialNotStored = \"material not stored\"\n)\n```\nReasons for a copy that stays inline, as the match report gives them.\n\n```go\nconst Marker = \"chainloop.replaced\"\n```\nMarker is the type of a pointer, and the name of the field that holds a pointer in place of a text field. It tells any reader that Chainloop replaced the content.\n\n## Functions\n\n```go\nfunc Digest(content []byte) string\n```\nDigest returns the digest of content in the form that Sources uses.\n\n```go\nfunc DigestReader(r io.Reader) (string, error)\n```\nDigestReader returns the digest of what r holds, in the form that Sources uses, with no copy of it in memory.\n\n```go\nfunc New(digest string) json.RawMessage\n```\nNew returns the pointer to the material with the given digest.\n\n## Types\n\n```go\ntype Report map[string]*Result\n```\nReport is the match report of one session, per finder.\n\n```go\nfunc (r Report) Finder(name string) *Result\n```\nFinder returns the result of a finder, which it adds when it is not there.\n\n```go\ntype Result struct {\n\t// Replaced is the number of copies replaced with a pointer.\n\tReplaced int\n\t// Skipped counts, per reason, the copies that stay inline.\n\tSkipped map[string]int\n\t// BytesRemoved is the size of the replaced content.\n\tBytesRemoved int\n}\n```\nResult counts the copies one finder looked at.\n\n```go\nfunc (r *Result) Skip(reason string, copies int)\n```\nSkip counts copies that stay inline for reason.\n\n```go\ntype Sources map[string]string\n```\nSources maps the digest of each spec source, as the file is on disk, to the digest of the material it is stored as. The two differ for a text file, whose material is its redacted copy.\n\n","path":"github.com/chainloop-dev/chainloop/app/cli/internal/trace/pointer","name":"pointer","synopsis":"Package pointer holds the parts of the pointers to spec sources that do not depend on the agent (spec issue-3556).","isRedistributable":true}
