What is EntityStorage? I'm attempting to understand the concept of entity storage. For example in this tutorial

https://www.sitepoint.com/drupal-8-version-entityfieldquery/

it's using code to load the nodes from nids in a similar way to this

$ids = \Drupal::entityQuery('node')
    -&gt;condition('status', 1)
    -&gt;execute();

$node_storage = \Drupal::entityManager()-&gt;getStorage('node');

// Load multiple nodes
$node_storage-&gt;loadMultiple($ids);


But I'm not sure exactly what this is doing

$node_storage = \Drupal::entityManager()-&gt;getStorage('node');


My best guess is that it's loading the format of how the node is stored in the database so it knows how to load everything based on that format, but that's just a guess.

Also side note: the path I normally take is doing a foreach loop on the query results and loading the node based on the nid inside that. Like so. But I'm not sure what's best practice.

        foreach ($ids as $nid) {
            $node  = Node::load($nid);
        }


What exactly is entityStorage, and what function is it providing?
Entity storage is a storage controller for the entity that handles the actual CRUD operations of entity data in the storage. That means it is responsible for inserting and deleting the entity data in the actual storage/repository.

The storage can be a .yaml file (for config entities) or a SQL database (for content entities). There are some specific use cases for null storage (like e-mail message) which basically means no data is stored anywhere and entity with such storage is just virtual: It exists only per single request as you define it.

You can additionally write your own storage controller and use remote storage, a file, a stream or whatever the requirements are.