public Map<String, StateHolder> getStateHolderMap(String partitionId, String queryName) {
        Boolean skipSnapshotable = skipStateStorageThreadLocal.get();
        if (skipSnapshotable == null || !skipSnapshotable) {
            PartitionIdStateHolder partitionIdStateHolder = this.partitionIdStates.get(partitionId);
            if (partitionIdStateHolder == null) {
                partitionIdStateHolder = new PartitionIdStateHolder(partitionId);
                this.partitionIdStates.put(partitionId, partitionIdStateHolder);
            }
            ElementStateHolder elementStateHolder = partitionIdStateHolder.getElementState(queryName);
            if (elementStateHolder == null) {
                elementStateHolder = new ElementStateHolder(queryName, new HashMap<>());
                partitionIdStateHolder.addElementState(queryName, elementStateHolder);
            }
            return elementStateHolder.elementHolderMap;
        }
        return null;
    }
Service level implementation to take/restore snapshots of processing elements.
Memory   : PartitionId + QueryName + ElementId + PartitionGroupByKey + Item
Snapshot : PartitionId + PartitionGroupByKey + QueryName + ElementId + Item
modules/siddhi-core/src/main/java/io/siddhi/core/util/snapshot/SnapshotService.java