code: func (s *Set) Add(c context.Context, items []Item) error {
  	// Pick a random shard and add all new items there. If this is a retry, they
  	// may exist in some other shard already. We don't care, they'll be
  	// deduplicated in 'List'. If added items have been popped already (they have
  	// tombstones), 'List' will omit them as well.
  	shardRoot := s.shardRoot(c, mathrand.Intn(c, s.ShardCount))
  	entities := make([]itemEntity, len(items))
  	for i, itm := range items {
  		entities[i] = itemEntity{
  			ID:     itm.ID,
  			Parent: shardRoot,
  			Value:  itm.Value,
  		}
  	}
  	return transient.Tag.Apply(batchOp(len(entities), func(start, end int) error {
  		return datastore.Put(c, entities[start:end])
  	}))
  }
docs: // Add idempotently adds a bunch of items to the set.
  //
  // If items with given keys are already in the set, or have been deleted
  // recently, they won't be re-added. No error is returned in this case. When
  // retrying the call like that, the caller is responsible to pass exact same
  // Item.Value, otherwise 'List' may return random variant of the added item.
  //
  // Writes to some single entity group (not known in advance). If called outside
  // of a transaction and the call fails, may add only some subset of items.
  // Running inside a transaction makes this operation atomic.
  //
  // Returns only transient errors.