# Package org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim

Abstracts a minimal subset of Kryo types and methods.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  InputShim | A minimal `Input`-like abstraction.
  KryoShim<I extends InputShim,O extends OutputShim> | A minimal `Kryo`-like abstraction.
  KryoShimService | This interface exists to decouple HadoopPools from TinkerPop's shaded Kryo.
  OutputShim | A minimal `Output`-like abstraction.
  SerializerShim<T> | A minimal `Serializer`-like abstraction.

- Class Summary
  Class | Description
  --- | ---
  KryoShimServiceLoader | Loads the highest-priority or user-selected `KryoShimService`.

## Package org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim Description

Abstracts a minimal subset of Kryo types and methods.

Kryo is often shaded. For instance, TinkerPop's Gryo serializer relies on a shaded Kryo package. TinkerPop serializers written against a particular shaded Kryo package (or an unshaded Kryo package) are compatible only with that package. In contrast, TinkerPop serializers written against this abstraction can be used with any shaded or unshaded Kryo package, so long as the signatures and behavior of the methods in this package remain stable.

To show how this is useful, consider `StarGraphSerializer`. This class has logic unique to TinkerPop that performs efficient and forward-compatible serialization of `StarGraph` instances. It takes advantage of package-level visibility and the fact that it shares a package with its target, so it would be challenging to cleanly and naturally replicate (i.e. without package spoofing or runtime visibility overrides). By implementing `SerializerShim` instead of, say, Gryo's shaded `Serializer`, such a serializer can be used with anybody's Kryo package, regardless of whether that package is shaded or not. This lets third-parties reuse TinkerPop's efficient, internals-aware StarGraph serializer on their own serialization platform (and without altering TinkerPop's bytecode, let alone its source).

The number of types and methods in this package is deliberately small to reduce the likelihood of a new Kryo release introducing an incompatible change.

Copyright © 2013–2022 Apache Software Foundation. All rights reserved.