| 245 | ) |
| 246 | |
| 247 | func (s *Store) GetInstanceStorageSetting(ctx context.Context) (*storepb.InstanceStorageSetting, error) { |
| 248 | instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{ |
| 249 | Name: storepb.InstanceSettingKey_STORAGE.String(), |
| 250 | }) |
| 251 | if err != nil { |
| 252 | return nil, errors.Wrap(err, "failed to get instance storage setting") |
| 253 | } |
| 254 | |
| 255 | instanceStorageSetting := &storepb.InstanceStorageSetting{} |
| 256 | if instanceSetting != nil { |
| 257 | instanceStorageSetting = instanceSetting.GetStorageSetting() |
| 258 | } |
| 259 | if instanceStorageSetting.StorageType == storepb.InstanceStorageSetting_STORAGE_TYPE_UNSPECIFIED { |
| 260 | instanceStorageSetting.StorageType = defaultInstanceStorageType |
| 261 | } |
| 262 | if instanceStorageSetting.UploadSizeLimitMb == 0 { |
| 263 | instanceStorageSetting.UploadSizeLimitMb = defaultInstanceUploadSizeLimitMb |
| 264 | } |
| 265 | if instanceStorageSetting.FilepathTemplate == "" { |
| 266 | instanceStorageSetting.FilepathTemplate = defaultInstanceFilepathTemplate |
| 267 | } |
| 268 | s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_STORAGE.String(), &storepb.InstanceSetting{ |
| 269 | Key: storepb.InstanceSettingKey_STORAGE, |
| 270 | Value: &storepb.InstanceSetting_StorageSetting{StorageSetting: instanceStorageSetting}, |
| 271 | }) |
| 272 | return instanceStorageSetting, nil |
| 273 | } |
| 274 | |
| 275 | func convertInstanceSettingFromRaw(instanceSettingRaw *InstanceSetting) (*storepb.InstanceSetting, error) { |
| 276 | instanceSetting := &storepb.InstanceSetting{ |