Yes, the barn style sliding door has a lock. Unfortunately, I do not have the details for the lock type. It was purchased & installed by the contractor.
You will be able to find out what type of lock can work for you, when you purchase the barn door.
How to get the "barn" smell out of an old barn door?
Interior Doors-Plank Doors, Barn Doors, Tiered Moulding,Infinite Rails
Can I make a sliding barn door out of a hollow core door?
Can unused pocket doors be converted to a barn door?