Records to be seen only when assigned or shared

Hello i have a custom module and when new records are created it should not be visible to set of users unless it is assigned to them or shared to them

how can i achieve this ?

please help.