nolint:funlen,gocyclo
(ctx context.Context, rep repo.Repository)
| 130 | |
| 131 | //nolint:funlen,gocyclo |
| 132 | func (c *commandRepositoryStatus) run(ctx context.Context, rep repo.Repository) error { |
| 133 | if c.jo.jsonOutput { |
| 134 | return c.outputJSON(ctx, rep) |
| 135 | } |
| 136 | |
| 137 | c.out.printStdout("Config file: %v\n", c.svc.repositoryConfigFileName()) |
| 138 | c.out.printStdout("\n") |
| 139 | c.out.printStdout("Description: %v\n", rep.ClientOptions().Description) |
| 140 | c.out.printStdout("Hostname: %v\n", rep.ClientOptions().Hostname) |
| 141 | c.out.printStdout("Username: %v\n", rep.ClientOptions().Username) |
| 142 | c.out.printStdout("Read-only: %v\n", rep.ClientOptions().ReadOnly) |
| 143 | |
| 144 | t := rep.ClientOptions().FormatBlobCacheDuration |
| 145 | if t > 0 { |
| 146 | c.out.printStdout("Format blob cache: %v\n", t) |
| 147 | } else { |
| 148 | c.out.printStdout("Format blob cache: disabled\n") |
| 149 | } |
| 150 | |
| 151 | dr, isDr := rep.(repo.DirectRepository) |
| 152 | if !isDr { |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | c.out.printStdout("\n") |
| 157 | |
| 158 | ci := dr.BlobReader().ConnectionInfo() |
| 159 | c.out.printStdout("Storage type: %v\n", ci.Type) |
| 160 | |
| 161 | switch cp, err := dr.BlobVolume().GetCapacity(ctx); { |
| 162 | case err == nil: |
| 163 | c.out.printStdout("Storage capacity: %v\n", units.BytesString(cp.SizeB)) |
| 164 | c.out.printStdout("Storage available: %v\n", units.BytesString(cp.FreeB)) |
| 165 | case errors.Is(err, blob.ErrNotAVolume): |
| 166 | c.out.printStdout("Storage capacity: unbounded\n") |
| 167 | default: |
| 168 | return errors.Wrap(err, "unable to get storage volume capacity") |
| 169 | } |
| 170 | |
| 171 | if cjson, err := json.MarshalIndent(scrubber.ScrubSensitiveData(reflect.ValueOf(ci.Config)).Interface(), " ", " "); err == nil { |
| 172 | c.out.printStdout("Storage config: %v\n", string(cjson)) |
| 173 | } |
| 174 | |
| 175 | contentFormat := dr.ContentReader().ContentFormat() |
| 176 | |
| 177 | mp, mperr := contentFormat.GetMutableParameters(ctx) |
| 178 | if mperr != nil { |
| 179 | return errors.Wrap(mperr, "mutable parameters") |
| 180 | } |
| 181 | |
| 182 | c.out.printStdout("\n") |
| 183 | c.out.printStdout("Unique ID: %x\n", dr.UniqueID()) |
| 184 | c.out.printStdout("Hash: %v\n", contentFormat.GetHashFunction()) |
| 185 | c.out.printStdout("Encryption: %v\n", contentFormat.GetEncryptionAlgorithm()) |
| 186 | c.out.printStdout("Splitter: %v\n", dr.ObjectFormat().Splitter) |
| 187 | c.out.printStdout("Format version: %v\n", mp.Version) |
| 188 | c.out.printStdout("Content compression: %v\n", mp.IndexVersion >= index.Version2) |
| 189 | c.out.printStdout("Password changes: %v\n", contentFormat.SupportsPasswordChange()) |
nothing calls this directly
no test coverage detected