github.com/hasnat/dolt/go@v0.0.0-20210628190320-9eb5d843fbb7/store/nbs/benchmarks/null_block_store.go (about)

     1  // Copyright 2019 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  // This file incorporates work covered by the following copyright and
    16  // permission notice:
    17  //
    18  // Copyright 2016 Attic Labs, Inc. All rights reserved.
    19  // Licensed under the Apache License, version 2.0:
    20  // http://www.apache.org/licenses/LICENSE-2.0
    21  
    22  package main
    23  
    24  import (
    25  	"context"
    26  
    27  	"github.com/dolthub/dolt/go/store/chunks"
    28  	"github.com/dolthub/dolt/go/store/hash"
    29  )
    30  
    31  type nullBlockStore struct {
    32  }
    33  
    34  func newNullBlockStore() (chunks.ChunkStore, error) {
    35  	return nullBlockStore{}, nil
    36  }
    37  
    38  func (nb nullBlockStore) Get(ctx context.Context, h hash.Hash) (chunks.Chunk, error) {
    39  	panic("not impl")
    40  }
    41  
    42  func (nb nullBlockStore) GetMany(ctx context.Context, hashes hash.HashSet, found func(*chunks.Chunk)) error {
    43  	panic("not impl")
    44  }
    45  
    46  func (nb nullBlockStore) Has(ctx context.Context, h hash.Hash) (bool, error) {
    47  	panic("not impl")
    48  }
    49  
    50  func (nb nullBlockStore) HasMany(ctx context.Context, hashes hash.HashSet) (present hash.HashSet, err error) {
    51  	panic("not impl")
    52  }
    53  
    54  func (nb nullBlockStore) Put(ctx context.Context, c chunks.Chunk) error {
    55  	return nil
    56  }
    57  
    58  func (nb nullBlockStore) Version() string {
    59  	panic("not impl")
    60  }
    61  
    62  func (nb nullBlockStore) Close() error {
    63  	return nil
    64  }
    65  
    66  func (nb nullBlockStore) Rebase(ctx context.Context) error {
    67  	return nil
    68  }
    69  
    70  func (nb nullBlockStore) Stats() interface{} {
    71  	return nil
    72  }
    73  
    74  func (nb nullBlockStore) StatsSummary() string {
    75  	return "Unsupported"
    76  }
    77  
    78  func (nb nullBlockStore) Root(ctx context.Context) (hash.Hash, error) {
    79  	return hash.Hash{}, nil
    80  }
    81  
    82  func (nb nullBlockStore) Commit(ctx context.Context, current, last hash.Hash) (bool, error) {
    83  	return true, nil
    84  }