Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17902#discussion_r119420304
  
    --- Diff: 
common/kvstore/src/main/java/org/apache/spark/kvstore/LevelDB.java ---
    @@ -0,0 +1,303 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.kvstore;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.HashMap;
    +import java.util.Iterator;
    +import java.util.Map;
    +import java.util.NoSuchElementException;
    +import java.util.concurrent.ConcurrentHashMap;
    +import java.util.concurrent.ConcurrentMap;
    +import java.util.concurrent.atomic.AtomicReference;
    +import static java.nio.charset.StandardCharsets.UTF_8;
    +
    +import com.google.common.annotations.VisibleForTesting;
    +import com.google.common.base.Objects;
    +import com.google.common.base.Preconditions;
    +import com.google.common.base.Throwables;
    +import org.fusesource.leveldbjni.JniDBFactory;
    +import org.iq80.leveldb.DB;
    +import org.iq80.leveldb.Options;
    +import org.iq80.leveldb.WriteBatch;
    +
    +/**
    + * Implementation of KVStore that uses LevelDB as the underlying data 
store.
    + */
    +public class LevelDB implements KVStore {
    +
    +  @VisibleForTesting
    +  static final long STORE_VERSION = 1L;
    +
    +  @VisibleForTesting
    +  static final byte[] STORE_VERSION_KEY = "__version__".getBytes(UTF_8);
    +
    +  /** DB key where app metadata is stored. */
    +  private static final byte[] METADATA_KEY = "__meta__".getBytes(UTF_8);
    +
    +  /** DB key where type aliases are stored. */
    +  private static final byte[] TYPE_ALIASES_KEY = 
"__types__".getBytes(UTF_8);
    +
    +  final AtomicReference<DB> _db;
    +  final KVStoreSerializer serializer;
    +
    +  private final ConcurrentMap<String, byte[]> typeAliases;
    --- End diff --
    
    this `typeAliases` thing is pretty confusing.  IIUC, the idea is to replace 
a long fully qualified type name with a shorter numeric id, and this holds the 
mapping?  I'd include a comment about it.  maybe even rename `typetoID`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to