MCPcopy Create free account
hub / github.com/pydio/cells / StorageStats

Method StorageStats

data/source/objects/grpc/handler.go:199–222  ·  view source on GitHub ↗

StorageStats returns statistics about storage

(ctx context.Context, _ *object.StorageStatsRequest)

Source from the content-addressed store, hash-verified

197
198// StorageStats returns statistics about storage
199func (o *ObjectHandler) StorageStats(ctx context.Context, _ *object.StorageStatsRequest) (*object.StorageStatsResponse, error) {
200
201 conf, er := o.getConfig(ctx)
202 if er != nil {
203 return nil, er
204 }
205
206 resp := &object.StorageStatsResponse{}
207 resp.Stats = make(map[string]string)
208 resp.Stats["StorageType"] = conf.StorageType.String()
209 switch conf.StorageType {
210 case object.StorageType_LOCAL:
211 folder := conf.LocalFolder
212 if stats, e := minio.ExposedDiskStats(context.Background(), folder, false); e != nil {
213 return nil, e
214 } else {
215 resp.Stats["Total"] = fmt.Sprintf("%d", stats["Total"])
216 resp.Stats["Free"] = fmt.Sprintf("%d", stats["Free"])
217 resp.Stats["FSType"] = fmt.Sprintf("%s", stats["FSType"])
218 }
219 }
220
221 return resp, nil
222}
223
224// CleanResourcesBeforeDelete removes the .minio.sys/config folder if it exists
225func (o *ObjectHandler) CleanResourcesBeforeDelete(ctx context.Context, request *object.CleanResourcesRequest) (resp *object.CleanResourcesResponse, err error) {

Callers

nothing calls this directly

Calls 3

getConfigMethod · 0.95
makeFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected