github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/internal/config/dns/store.go (about)

     1  // Copyright (c) 2015-2021 MinIO, Inc.
     2  //
     3  // This file is part of MinIO Object Storage stack
     4  //
     5  // This program is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU Affero General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // This program is distributed in the hope that it will be useful
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  // GNU Affero General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Affero General Public License
    16  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17  
    18  package dns
    19  
    20  // Error - DNS related errors error.
    21  type Error struct {
    22  	Bucket string
    23  	Err    error
    24  }
    25  
    26  // ErrInvalidBucketName for buckets with invalid name
    27  type ErrInvalidBucketName Error
    28  
    29  func (e ErrInvalidBucketName) Error() string {
    30  	return e.Bucket + " invalid bucket name error: " + e.Err.Error()
    31  }
    32  
    33  func (e Error) Error() string {
    34  	return "dns related error: " + e.Err.Error()
    35  }
    36  
    37  // ErrBucketConflict for buckets that already exist
    38  type ErrBucketConflict Error
    39  
    40  func (e ErrBucketConflict) Error() string {
    41  	return e.Bucket + " bucket conflict error: " + e.Err.Error()
    42  }
    43  
    44  // Store dns record store
    45  type Store interface {
    46  	Put(bucket string) error
    47  	Get(bucket string) ([]SrvRecord, error)
    48  	Delete(bucket string) error
    49  	List() (map[string][]SrvRecord, error)
    50  	DeleteRecord(record SrvRecord) error
    51  	Close() error
    52  	String() string
    53  }